cancel
Showing results for 
Search instead for 
Did you mean: 

CheckBox

Former Member
0 Kudos

Dear Forum,

In table I have two rows with two check boxes.

When I am clicking 1st check box the first row is shown.Afterthat if I click 2nd check box, the second row is shown.But at that time 1st check box is also checked.

1.My criteria is -


When I will click 2nd check box, 1st check box will be forcedfully unchecked.

2.My Second Criteria is----


There is a button 'Select All'. If I click 'Select All' button all the check boxes in the table will be checked

and coressponding rows will be shown at the bottom of the table.

Please help me out.

Regards,

Anindita

Accepted Solutions (1)

Accepted Solutions (1)

former_member751941
Active Contributor
0 Kudos

Hi Anindita,

Take a node say Employee with attribute

id type string

name type string

isChecked type boolean

Try these codes

For criteria 1 : On selection of on toggle button action =====>

-


public void onActionEmployeeCheck(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionEmployeeCheck(ServerEvent)

int size = wdContext.nodeEmployee().size();

int currentrow = wdContext.nodeEmployee().getLeadSelection();

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

{

if(i == currentrow)

{

wdContext.nodeEmployee().getEmployeeElementAt(currentrow).setIsChecked(true);

wdComponentAPI.getMessageManager().reportSuccess("ID : "+wdContext.nodeEmployee().getEmployeeElementAt(currentrow).getId());

wdComponentAPI.getMessageManager().reportSuccess("Name : "+wdContext.nodeEmployee().getEmployeeElementAt(currentrow).getName());

}

else

wdContext.nodeEmployee().getEmployeeElementAt(i).setIsChecked(false);

}

//@@end

}

For criteria 2 : On selection of SelectAllRows Button Action====>

-


public void onActionGetAllRows(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionGetAllRows(ServerEvent)

int size = wdContext.nodeEmployee().size();

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

{

wdContext.nodeEmployee().getEmployeeElementAt(i).setIsChecked(true);

wdComponentAPI.getMessageManager().reportSuccess("ID : "+wdContext.nodeEmployee().getEmployeeElementAt(i).getId());

wdComponentAPI.getMessageManager().reportSuccess("Name : "+wdContext.nodeEmployee().getEmployeeElementAt(i).getName());

}

Regards,

Mithu

Former Member
0 Kudos

Hi Mithu,

Thanks a lot.

Regards,

Anindita

Answers (1)

Answers (1)

yogesh_galphade
Contributor
0 Kudos

Dear Anindita

This is one of limitation in webdynpro handling checkbox is really a mess

Anyway for select all you can give one button and make all checkbox as true.

For Unchecking the 1st checkbox when you click 2nd checkbox, you need to get the row selected and check condition which are checked before selected row.

Former Member
0 Kudos

"This is one of limitation in webdynpro handling checkbox is really a mess"

I don't think so. What do you mean with this?

Armin

yogesh_galphade
Contributor
0 Kudos

Hi

I regrete for that.

Actually I took in different manner because I was looking for the Table performance as it takes server round trips when we select the row. So I changed table property to readonly Also I was using the checkbox to tick the row. In this case to do validation was more complex because we cannot get the leadselected. There were 150 fields suppose to do the validations.

Edited by: Yogesh Galphade on Mar 26, 2009 5:36 PM

Former Member
0 Kudos

The server roundtrip that happens when the lead selection is changed should not be a problem. There are no validations executed. Maybe you had assigne some validating action to the onLeadSelect event?

And this has nothing to do with check boxes.

Armin