on 04-26-2009 5:43 AM
Hi All,
in my application iam using two tables,
this is my code
int selection = wdContext.nodeA().getLeadSelection();
String num = wdContext.nodeA.geAAt(selection).getV_Num();
for(int b=0;b<wdContext.nodeVn_Context().size();b++)
{
if(wdContext.nodeVn_Context().getVn_ContextElementAt(b).getVa_num().equalsIgnoreCase
(num))
{
wdContext.nodeVn_Context().removeElement(wdContext.nodeVn_Context().getVn_ContextElementAt(b));
}
}
here Vn_Context is having 4 rows, i mean size of Vn_Context is 4. when i use this code to remove that 4 rows based on the condition, which i gave in if, its able to remove only one row, so how to remove those four rows, is this code correct or not, please help me.
Hello Sushma,
Assuming that your node allows multi-selection, use the following method:
Loop over the elements and select each element using the setSelected() method, according to your condition, eg.
wdContext.nodeXXX.setSelected(idx, true/false)
At the end of the loop call the method removeSelectedElements().
wdContext.nodeXXX.removeSelectedElements();
Walter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this code,
for (int i = wdContext.node<Node>().size() - 1; i >=0; --i)
{
I<Node>Element e = wdContext.node<Node>().get<Node>ElementAt(i);
if ( condition_to_delete(e) )
wdContext.node<Node>().removeElement(e);
}
Regards,
Sunaina Reddy T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sushma,
please follow the below link
page no 17 explains how to delete multiple rows.
regards
Narendra
Edited by: Narendra Singh on Apr 27, 2009 8:19 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Write this code in your method.
int n = wdContext.nodeA().size();
int leadSelected = wdContext.nodeA().getLeadSelection();
String num = wdContext.nodeA.geAAt(selection).getV_Num();
// loop backwards to avoid index troubles
for (int i = n - 1; i >= 0; --i)
{
if(wdContext.nodeVn_Context().getVn_ContextElementAt(b).getVa_num().equalsIgnoreCase
(num))
{
if (wdContext.nodeA.isMultiSelected(i) || leadSelected == i)
{
wdContext.nodeA().removeElement(
wdContext.nodeA().getElementAt(i));
}
}
}
Thanks
Abhilasha
Edited by: Abhilasha Dahare on Apr 27, 2009 7:24 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
instead of the forward loop , try reverse loop.
Regards
Rajendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.