cancel
Showing results for 
Search instead for 
Did you mean: 

Select All / Deselect All action for itemListBox

Former Member
0 Kudos

Hi Expert,

I am newbie on Web Dynpro and want to know if that is possible to implement

[Select All] [ Clear ] button as for itemListBox

In the itemListBox i have enabled mutli select option, but i found it hard to select/deselect all unless i create a separate button to do so.

I couldnt find any relevant options available in help.sap.com.

Could someone provide me please

Thanks you!

BR - Chris

Accepted Solutions (0)

Answers (2)

Answers (2)

ramakrishnappa
Active Contributor
0 Kudos

Hi Christ,

Yes, itemListBox in WDa is not having option for select all/deselect all

Note: There is an event OnLeadSelect which triggers on select of any item on list box but when you set property "multipleSelection" to true the the event will never trigger

If your requirement is to select all and deselect all items in the list box on any button action , you need to process corresponding to that

add 2 new items say : Select all & Deselect all to the context node at index 1 & 2

Example:

Node contains the data as below

1. Select All

2. Deselect All

3. item1

4. item2

5. item3

6. item4

7. item5

When user selects item  "Select All" and clicks on display button.

Now get the selected elements from node using method ( IF_WD_CONTEXT_NODE)~GET_SELECTED_ELEMENTS and

If selected item contains "Select all" then consider all items from index 3 onwards for your processing.

 

When user selects item "Deselect All" , Refresh the node

     

Regards,

Rama

Former Member
0 Kudos

Hi Rama,

Thanks for your reply.

Both Rama and Sharath shoud be good method to do select/deselect all function.

Is there any method for me set an item selected in itemListBox?

I can only found get_selected_elements but not something like set_selected

Could provide code example if possible?

Thanks.

BR - Chris

Sharathmg
Active Contributor
0 Kudos

As far as i know, the IF_WD_CONTEXT_NODE has the method set_selected method for the element.

please check it.

regards,

sharath

Sharathmg
Active Contributor
0 Kudos

As you say, by default the ItemListBox UI does not provide the option "Select All/Deselect All" like in table. Then, you have to have a button or any other UI element with event to perform this for you.

Simplest option would be a button(which toggles) and use it to select all entries or unselect all entries.

Regards,

Sharath