Skip to Content
avatar image
Former Member

Deletion of selected rows in WD Java table

Hi Experts,

We have a requirement to select (Using check box as a TableCellEditor to select the rows) any row (Single OR multiple) in a WebDynpro java table and to remove the selected rows from the table on action (Button).

Data come from BAPI and we are using Value Node as a Data Source for this table. Our NWDS version is 7.01.

Please suggest appropriate method to achieve the same.

Thanks and Regards,

Ghanshyam Agarwal

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 14, 2015 at 09:49 AM

    Hi Ghanshyam..

    Create an attribute(Boolean) at table level node (0..n).

    and create one action for delete selected rows. and put below code..

    *************************

    IPublicVcTrgCrtOrdComp.I<your value node>Element element;

          for(int i = 0; i< wdContext.node<your value node>().size();i++)

          {

           element = wdContext.node<your value node>().get<your value node>ElementAt(i);

        

           if(element.get<selected attribute>() )

           {

            wdContext.node<your value node>().removeElement(element);

            i = i-1;

           }

       

          }

    ********************************

    Thanks & Best Regards

    Aasif Shah

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 14, 2015 at 08:21 AM

    Hi Ghanshyam,

    can't you just add a boolean attribute to the node and bind a checkbox to it in the table? Then you could loop over the node entries and delete the checked ones.  I don't know the possibilities of 7.01 so i can't exactly tell you the solution.

    Regards,

    Tobias

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Tobias Hamdorf

      Please find the code below for your reference.

           boolean select = wdcontext.node<node_name>.current<node>Element.getCheckBox();

           int nodeLength = wdcontext.node<node_name>.size();

           for(int i=0; i<nodeLength; i++){

               

                if(Select){

                         wdcontext.node<node_name>.removeElement(wdcontext.node<node_name>current<node>Element());     }

      }