cancel
Showing results for 
Search instead for 
Did you mean: 

Add a new element at table adds at the end and overwrites last

Former Member
0 Kudos

A view context is mapped to custom controller context.

At the view context(mapped to table view), when i add an element to the node,

the node is added to the end and the last element is also overwritten with the new one.

The lead selection is at the last element.

-


Before add

- at = 0Daniel Bortz

- at = 1T&E Administrator

after add ++++++

- at = 0 Daniel Bortz

- at = 1 Deborah Holmes

- at = 2 Deborah Holmes

sizeApprList, leadApprList : 2, 1

-


NOTE: the sizeApprList above should be 3 NOT 2

I create a new element and add it to the existing node.

Should I have to bind this new element.

Here is the code -


Zte_Apr_Agents apprvrModel = wdContext.currentApprovers_TabElement().modelObject();

IApprovers_TabElement newEtUserElem = wdContext.nodeApprovers_Tab().createApprovers_TabElement(apprvrModel);

newEtUserElem.setAttributeValue("Agent_Name", "Deborah Holmes" ) ;

. . . . .

int sizeApprList = wdContext.nodeApprovers_Tab().size();

wdContext.nodeApprovers_Tab().addElement(sizeApprList, newEtUserElem);

-


Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Just modify this line of code:

wdContext.nodeApprovers_Tab().addElement(sizeApprList, newEtUserElem);

to

wdContext.nodeApprovers_Tab().addElement(newEtUserElem);

Regards,

Murtuza

Former Member
0 Kudos

Hi Murtuza,

Thanks for your reply.

I tried the one you suggeted. but same problem.

Thanks.

Former Member
0 Kudos

Hi,

If you are adding a row to a table on a click of a button then write this code on the event for a button.

IPrivate<viewname>.I<nodename>Element ele = wdContext.node<nodename>().create<nodename>Element();

ele.set<attribute>(<value>);

wdContext.node<nodename>().addElement(ele);

I have tried same locally on my machine and it is working fine for me.

Regards,

Murtuza