cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove multiple rows from table

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

dfs

Former Member
0 Kudos

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);
}

Armin

Former Member
0 Kudos

Hi sushma,

if you have 4 row then why should you give the condition for removing rrow..because when you gave condition the depends on your lead selection of getVa_num().so you will return perticullar row of getVa_num(). value of lad selection ..this would not match of other row value(getVa_num().so it will remove only that value of lead selection of getVa_num().

better you remove taht condition.

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));

//}

}

no need to give the condition right now..

if you want to remove multiselection row,i mean selected row for multiple then you select the row as per your rows delete.

for(int b=0;b<wdContext.nodeVn_Context().size();b++)

{

if(lead==b || wdcontext.nodeVn_Context().isMultiselection(b){

wdContext.nodeVn_Context().removeElement(wdContext.nodeVn_Context().getVn_ContextElementAt(b));

}

}

this way you do solve your problem..

thanks

jjati