cancel
Showing results for 
Search instead for 
Did you mean: 

Issues in Deleting table rows

Former Member
0 Kudos

Hi all,

After deleting any rows/row in the WebDynpro table it is showing one blank row showing the presence of row there already. This blank row is appearing when we add new row next time. I don't want to appear this blank line after deleting the row. I Used

wdContext.nodename().removeElement();

removeElement() to delete the row.

Is there any other possibilities to avoid this.

Plz let me know.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

if you want to delete a row in a table use the follwing code,

IWDNodeElement e=wdContext.node<Nodename>().getElementAt(position); //position refers the number of the row which is going to be deleted.

wdContext.node<Nodename>().removeElement(e);

Former Member
0 Kudos

Hi

Thanks for your quick reply.

I am deleting the table rows in the way as you told,then also it is showing the same problem. Is any more Ideas.

Former Member
0 Kudos

Hi,

only one blank row or more? can you post your code here?

Former Member
0 Kudos

HI

How many rows i am deleting that much blank rows are available. Here is the code which i used,

int leadSelected=wdContext.nodename().getLeadSelection();

for(int i=r2-1;i>=0;--i)

{

if(wdContext.nodename().isMultiSelected(i)||leadSelected==i)

{

wdContext.nodename().removeElement(wdContext.nodename().getElementAt(i));

}

}

plz reply.

Former Member
0 Kudos

Hi,

Those blank rows are created by default. if you have 5 rows in your table and table's visible column count is 5, then you delete one row.

Now the table shows 4 rows with values and one empty row, because visible row count is 5. That's why the table automatically add one row in it.

Former Member
0 Kudos

Hi,

Thanks for your reply.

I got your point, but if i set the visible row count as 4, next time if i add one row means that empty row is also displaying. Is there any other way to reduce the visible row count, other than this.

Former Member
0 Kudos

Hi,

Create one value attribute in context and bind it with rowCount property of the table.

After deletion, you have to set the visible rowcount as

int r=wdContext.node<tablenode>.size();

wdContext.currentContextElement().set<visiblerow>(r);

sridhar_k2
Active Contributor
0 Kudos

Hi,

Try this code, it may use full for you.

<b>Removing Element</b>


ITestNodeElement ele = (ITestNodeElement) wdContext.nodeTestNode().getElementAt(wdContext.nodeTestNode().getLeadSelection());
wdContext.nodeTestNode().removeElement(ele);

<b>Adding Element to the node</b>


ITestNodeElement testNodeELe = null;
testNodeELe = wdContext.nodeTestNode().createTestNodeElement();
testNodeELe.setTest1("Second ");
testNodeELe.setTest2("Third ");
wdContext.nodeTestNode().addElement(testNodeELe);

It is working fine for me.

Note: - TestNode is the node and Test1 and Test2 are the two elements in the node

Regards,

Sridhar

Former Member
0 Kudos

krishnaveni,

Now it's hard to understand where is the problem.

Try the following:

1. Make sure that cardinality of node used as Table.dataSource is 0..n (not 1..n)

2. Create calculated read-only attribute of type integer, bind visibleRowCount to this attribute and add the following code as calculated attribute "getter":


return Math.min(wdContext.nodeTableDataSource().size(), 5);

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com