on 03-15-2007 7:21 AM
Hi,
I have a table with first column's TableCelleditor as check box. When I tick on check box ( one or many) and when I click on Delete Button, I want that selected row or rows to get deleted.
I have created a node for that table and in that node i have created a value attribute as chkbox with type as boolean. I have bind chkbox context to checkbox column.
Following is the code for delete button:
int checkTableSize = wdContext.nodeDrafts().size();
wdContext.nodeDrafts().moveFirst();
for(int i = 1; i <= checkTableSize; i++)
{
boolean value = wdContext.currentDraftsElement().getChkBox();
if(value)
{
wdContext.nodeDrafts().removeElement(wdContext.nodeDrafts().getElementAt(i));
}
The problem is that am not able to delete the row.
Can anybody help me in this case.
Regards,
Vaibhav
Hi Vaibhav Khairnar,
Try something like this:
int checkTableSize = wdContext.nodeDrafts().size();
wdContext.nodeDrafts().moveFirst();
for(int i = <b>0</b>; i <= checkTableSize; i++)
{
boolean value = wdContext.currentDraftsElement().getChkBox();
if(value)
{
wdContext.nodeDrafts().removeElement(wdContext.nodeDrafts().getElementAt(i));
<b>checkTableSize--;
i--;</b>
}
It's better to use while than for because you change 'i' in the process.
Omri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use following method.
int checkTableSize = wdContext.nodeDrafts().size();
for(int i = checkTableSize-1;i>=0; i--)
{
//To check which row has been checked. Dont use Current element. It will always return lead selected row
boolean value = wdContext.nodeDrafts().getDraftsElementAt(i).getChkBox();
if(value)
{
wdContext.nodeDrafts().removeElement(wdContext.nodeDrafts().getElementAt(i));
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi ,
whatever code you have written for deleting row , write that in button click action,
and if it is already there then check if there is other code which helps filling the data into the table .
regards,
abhijeet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.