on 10-30-2012 4:42 AM
Hello Experts,
In My Application I have a scenario of populating values in one dropdown based on the value selected in another drop down. Both dropdowns are by index can you please suggest me solution.(Ex: Based on the country selected in one dropdown all the states corresponding to that country should be populated in another dropdown).
Hi Santosh,
DropDownByIndex UI element has an event onSelect. Whenever the user changes the entry in the field using this dropdown, this method is triggered.
Now, you can have two separate context nodes with cardinality 0..n and add the corresponding attributes.
For the parent context node, u can use a supply function to fill the country names.
For the child context node, u can use a supply function to fill the state names depending on the country value fetched from the parent node.
For the parent drop down, add a method say 'UPDATE_STATES' to the event onSelect. Remember to check the checkbox to 'Transfer UI event Parameters'.
Now in the method, add the following code:
DATA LS_ATTRIBUTES TYPE WD_THIS->ELEMENT_PARENT.
DATA LV_INDEX TYPE I.
DATA LO_ND_PARENT TYPE REF TO IF_WD_CONTEXT_NODE.
CALL METHOD WDEVENT->GET_DATA
EXPORTING
NAME = 'INDEX'
IMPORTING
VALUE = LV_INDEX.
* navigate from <CONTEXT> to <PARENT> via lead selection
LO_ND_PARENT = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_PARENT ).
CALL METHOD LO_ND_PARENT->SET_LEAD_SELECTION_INDEX
EXPORTING
INDEX = LV_INDEX.
N.B: Here parent is the name of the context node.
Hope it helps
Regards,
Sayan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Santhosh,
Lets have 2 drop downs . 1 for country and 2 for the corresponding states.
Create a method for the 1st drop down. Inside the method read the value of the 1st drop down.
and after reading the value of the 1st drop down , in the same method now bind the values to the 2nd drop down based on the 1st value drop down. ( Here u can use case statement.).
Regards
Arvnd
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.