cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any UI Element with "Select All" and "Deselect All" Option?

Former Member
0 Kudos

Hi,

Can any one please help me in finding such a control in Web DynPro which is like a table and has the option to select or deselect all the rows of the table?

Regards,

Smriti.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

HI Smriti,

Insert one mode column to the table with Chechbox as editor. Create a boolean context variable (Check) inside table node and bind to Checked Property.

Create 2 buttons, Select All and Deselect All.

In SelectAll button's action, write this code

IPrivate<View>.I<Table>Node tNode=wdContext.node<Table>().;

for(int i=0;i<tNodesize();i++)

{

tNode.get<Table>ElementAt(i).setCheck(true);

}

In DeselectAll button's action, write this code

IPrivate<View>.I<Table>Node tNode=wdContext.node<Table>().;

for(int i=0;i<tNodesize();i++)

{

tNode.get<Table>ElementAt(i).setCheck(false);

}

Regards

Fahad Hamsa

Former Member
0 Kudos

Hi Fahad Hamsa,

Thanks a lot.

Regards,

Smriti.

Former Member
0 Kudos

How about this?

create a toolbartogglebutton and onaction, do something like this

// toggleSelect to record the state of button

boolean tf = wdContext.currentContextElement().getToggleSelect();

// assume you have the node call projects

wdContext.nodeProjects().setLeadSelection(-1);

if (tf){

for (int i = 0; i < wdContext.nodeProjects().size(); i++) {

wdContext.nodeProjects().setSelected(i,false);

};

wdContext.currentContextElement().setToggleSelect(false);

} else {

for (int i = 0; i < wdContext.nodeProjects().size(); i++) {

wdContext.nodeProjects().setSelected(i,true);

}

wdContext.currentContextElement().setToggleSelect(true);

}

So you can toggle between select all and deselect all.

Yung siu wai

Former Member
0 Kudos

Hi Yung siu wai,

I am getting an exception on writing this code at the line:

"wdContext.nodeProjects().setLeadSelection(-1);"

Exception: "selection cardinality does not allow to clear the selection "

Regards,

Smriti.

Former Member
0 Kudos

Hi Yung siu wai ,

Can you please let me know how to highlight all the rows of the table once i have selected all the elements?

Thanks and Regards,

Smriti

Former Member
0 Kudos

The only way to hightlight, is really just changing the text to blue instead of black.

Former Member
0 Kudos

Can you please tell me how to change the colour?

Regards,

Smriti

Message was edited by:

Smriti Behl

Former Member
0 Kudos

chk it

Former Member
0 Kudos

Hi ,

Your selection error is related to your context node setting where you probably have select as 1..n so WD does not allow you to set NoSelection. Fix it by changing it to 0..n.

Yung siu wai