Skip to Content
avatar image
Former Member

Regarding deleting rows from a table..

Hi

While trying to remove multiple rows from a table,using removeElement ,all the rows are not geting removed. Only some rows get removed.. am using NWDS7.0.

Plz help.

Regards

Renu Nair

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • avatar image
    Former Member
    Jul 11, 2008 at 08:44 AM

    Hi,

    I hope you are using for statement to loop through the node to remove the elements. Could you please post the code that you are using to remove the element. This will help me to analyze the problem.

    thanks & regards,

    Manoj

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 11, 2008 at 08:57 AM

    Use this code.

    for( int i = 0; i < wdContext.nodeDisplayNode().size(); i++)

    {

    if( wdContext.currentDisplayNodeElement().getname()

    .equals( wdContext.nodeDisplayNode().getDisplayNodeElementAt( i).getname()))

    {

    // Remove Statement

    }

    }

    Regards

    Vinod

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 11, 2008 at 09:12 AM

    Hi

    You can directly do following onAction() of delete button

    wdContext.node<value node>().invalidate() ;

    where value node is node which is data source for table.

    Mandeep Virk

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 11, 2008 at 09:20 AM

    try this code

        int size =  wdContext.node<Table>().size();
        int lead = wdContext.node<Table>().getLeadSelection();
        IPrivate<Component>View.I<Table>Element element;
        for(int i =0 ; i<size; i++){
        	if(lead==i||wdContext.node<Table>().isMultiSelected(i)){
        		element = wdContext.node<Table>().get<Table>ElementAt(i);
        		wdContext.node<Table>().removeElement(element);
        	}
        }
    
    

    nikhil

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 11, 2008 at 09:38 AM

    Hi,

    As i said in my previous post that you need to loop backward. Here is an example code:

    IPrivateLabIDView.ILabAddrListElement labAddrEle;
    for(int index = addrListSize-1; index >=0  ; index--) {			
    wdContext.nodeLabList().setLeadSelection(size - 1);
    labAddrEle = wdContext.nodeLabAddrList().getLabAddrListElementAt(index);
    wdContext.nodeLabAddrList().removeElement(labAddrEle);
    }
    

    Hope this helps.

    thanks & regards,

    Manoj

    Add comment
    10|10000 characters needed characters exceeded