cancel
Showing results for 
Search instead for 
Did you mean: 

DropDownList

former_member1193316
Participant
0 Kudos

Hi,

How to get the table values in the dropdown list. how to bind it. could you please explain me how to do this along with code.

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Create a dropdownby key element in your view, and bind the selectedKey property to whichever node attribute you wish to bind. When you select a value in the dropdown, it is this value you have to bind.

The code will be like:

data: lr_node type ref to if_wd_context_node,

lt_valueset type table of wdr_context_attr_value,

ls_valueset type wdr_context_attr_value,

lr_nodeinfo type ref to if_wd_context_node_info.

lr_node = wd_context->get_child_node('NODE').

lr_nodeinfo = lr_node->get_node_info( ).

ls_valueset-value = 1.

ls_valueset-text = 'Value 1'.

append ls_valueset to lt_valueset.

cleaR: ls_valueset.

ls_valueset-value = 2.

ls_valueset-text = 'Value 2'.

append ls_valueset to lt_valueset.

lr_nodeinfo->set_attribute_value_set(

exporting

name = 'ATTRIBUTE_NAME'

valueset = lt_valueset

).

Do this in the wddoinit method of your view so that the values will be populated initially. Define an action for the onSelect event of the drop down. In the event handler, if you do a get_element on the node, the value selected will be returned. The 'value' in the value set is what will be selected. The text is what you will see displayed in the UI.

This sample code is for drop down by key. You can have a drop down by index also. Refer to the component WDR_TEST_EVENTS for both types of drop downs.

Hope this helps. Reward points for useful answers.

Regards,

Nithya

Former Member
0 Kudos

Hi Nithya.

This questions is answered so often meanwhile we should consider to write

an entry in the WIKI for filling dropdownbykey and dropdownbyindex.

Any volunteers? hehehe

Cheers,

Sascha

mohammed_anzys
Contributor
0 Kudos

Hi

Its true , we should put the code snnippets in the WIKI...

@ sascha , i am game...We will put it in WIKI

Former Member
0 Kudos

Hi ANzy.

I have restructed the WIKI section a bit some time ago. Maybe we should put it in the UI Elements section of the FAQ. When I find some time I will do an update of the context section with the attribute value set thing.

In general it would be cool if we would put some more effort in the WIKI section.

Maybe we can brainwash people into searching the WIKI and the forum by posting links to solutions to their questions and not answering each question over and over. But for this we need more content in the WIKI.

Cheers,

Sascha

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

If your issue is solved, can you please award points and close the thread.

Regards

Nithya