cancel
Showing results for 
Search instead for 
Did you mean: 

how to populate values in to drop down by index

Former Member
0 Kudos

Hi in my application i have dropdownby index with label State.In that dropdown i need to populate all the states of our country like..Tamilnadu,andhraprdesh,Gujrath,Maharastra,Delhi....,and by default it should be populated with Select State ,can u please tell me the code..

Thanks

Kishore

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

dsds

Former Member
0 Kudos

Hi Kishore,

Rather than using code for this, use the properties of the node.

Set the cardinality to 1...n (This will remove the initial blank from the list) and set Initialize lead selection to True (this will set the lead selection to the first element).

Regards,

Kartikaye

Former Member
0 Kudos

hi,

1.in ur context create a context value node----eg: MyStates

2.under that value node create a value attribute--eg: values.

3.set the cardinality of "MyStates" value node to 0:n

4.texts property of ur dropdown by index ui element shld be bound to the value attr (values).

5.in the wdDoInit() method of ur view that has this dropdownbyindex ui element use the follwoing code,

String    [  ]    states_array    =        new String [  ]   {"tn", "mp", "ap", "karnataka"};
List list_for_node_elem = new ArrayList();

   for (int i =  0; i <states_array.length; ++i)

   {

      IPrivateMyView.IMyStatesElement elem = wdContext.createMyStatesElement();
      MyStatesElement.setValues(states_array   [i ]   );
      list_for_node_elem.add(MyStatesElement);

   }

   wdContext.nodeMyStates().bind(list_fornode_elem);

   wdContext.nodeMyStates().setLeadSelection(1);

Regards

Jayapriya

Former Member
0 Kudos

Hi priya,

Thanks for your reply,at the same time Select State should be populated defaulty,can you tell me how to do it.

Thanks

Kishore

Former Member
0 Kudos

Hi,

just add the "Select State" string to array object "states_array"

String [ ] states_array = new String [ ] {"Select State","tn", "mp", "ap", "karnataka"};

// remaining code from the Jayapriya post

wdContext.nodeMyStates().setLeadSelection(0);

Regards,

ramesh

Former Member
0 Kudos

Hi,

Please go through this link

http://help.sap.com/saphelp_nw70/helpdata/EN/4a/8613e41629344194e4f40393740d51/frameset.htm

if you are using the rfc to populate the DropDownByIndex then just bind the output attribute to texts property of the dropdown and execute the rfc in DoInit method of the view.

Regards,

ramesh