on 09-07-2007 6:39 AM
Hi ..
I need to perform delete operation in my table with multiple selection.
My coding is..
for(int i=wdContext.nodeDetails2().size()-1;i>=0;i--)
{
if(wdContext.nodeDetails2().isMultiSelected(i) || wdContext.nodeDetails2().getLeadSelection()==i)
{
wdContext.nodeDetails2().removeElement(wdContext.nodeDetails2().getDetails2ElementAt(i));
}
}
When i delete first record, It works fine and multiple selection also works fine.
But when i select last record(only one) to delete, Then All the records get deleted. ???? Why this happens???
Anybody help to solve this probelm..
Thnx in advance..
Regards,
GS
Hi Satish,
Try putting this code
for(int i = wdContext.nodeOutput2().size()-1;i<=0;i--)
{
if(wdContext.nodeDetails2().isMultiSelected(i) || wdContext.nodeDetails2().getLeadSelection()==i)
{
wdContext.nodeDetails2().removeElement(wdContext.nodeDetails2().getDetails2ElementAt(i));
}
}
Regards,
Murtuza
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sathish,
Store the node size in a variable then try. To avoid problems with the index, the context is executed in reverse. Suppose in a table you have 10 rows and you are deleting row 2 the after deletion of row 2 row 3 will come to row 2,row 4 will come in row 3 in this way process will be continue up to last row.
Try this.
int n = wdContext.nodeDetails2().size();
int leadSelected = wdContext.nodeDetails2().getLeadSelection();
// loop backwards to avoid index troubles
for (int i = n - 1; i >= 0; --i) {
if (wdContext.nodeDetails2().isMultiSelected(i) || leadSelected == i) {
wdContext.nodeDetails2().removeElement(wdContext.nodeDetails2().getDetails2ElementAt(i));
}
}
Regards,
Mithu
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.