on 03-26-2009 8:30 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.