Show TOC Start of Content Area

Procedure documentation Implementing a Combo Box  Locate the document in its SAP Library structure

An InputField UI element is displayed as a combo box if the relevant context attribute has a proposal list. A combo box is a combination of a drop down list and an input field. This allows users to type a value directly into the control and to pick from a list of existing options.

In Web Dynpro, you get a combo box by assigning a proposal list (interface com.sap.typeservices.IProposalList) to the context attribute that the value property of an InputField is bound to.

The screenshot below shows a combo box.

This graphic is explained in the accompanying text

Prerequisites

You have created a Web Dynpro Project including component, window and application.

Procedure

...

       1.      In the context for your view MyView, create a node called MyNode.

       2.      Set the following properties for MyNode:

       Selection Cardinality to 1..1

       3.      Select MyNode and create an attribute city.

       4.      Insert an InputField and bind the value property of the InputField to context attribute city.

       5.      Add the following code to method wdDoInit():

IProposalList proposalsCity = wdContext.nodeMyNode().getNodeInfo().getAttribute(IPrivateMyView.IMyNodeElement.CITY).getModifiableSimpleType().getSVServices().getProposals();

   proposalsCity.add("New York");

   proposalsCity.add("Rio");

   proposalsCity.add("Paris");

   proposalsCity.add("Bangalore");

   proposalsCity.add("Palo Alto");

You can easily reset the proposal list using this code:

proposalsCity.reset();

 

End of Content Area