Skip to Content
author's profile photo Former Member
Former Member

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

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);

-


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Dec 21, 2007 at 03:32 AM

    Hi,

    Just modify this line of code:

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

    to

    wdContext.nodeApprovers_Tab().addElement(newEtUserElem);

    Regards,

    Murtuza

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.