on 01-14-2015 8:11 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
update your code with below code
******************************************************************************************
IPublicVcTrgCrtOrdComp.I<your value node>Element element;
int selectedRows = 0;
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>() )
{
selectedRows= selectedRows+1;
wdContext.node<your value node>().removeElement(element);
i = i-1;
}
}
if(selectedRows == 0)
{
wdComponentAPI.getMessageManager().reportException("Please Select any record for delete");
}
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tobias,
I have already added a boolean attibute to the node and assigned it to the chckebox. I have tried a for loop in on action code to get the selected rows but its picking only the first row and the rest of the rows remain unselected even after clicking on the checbox. I need to delete all the selected rows.
Please suggest.
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()); }
}
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.