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

WD Tut18: when to bind and when to addElement() ???

Hi All,

I am trying <b>Context Programming and Data Binding (18) tutorial</b>.

I am slight confused.. when to bind() and when to addElement()'s:

page 22>>


page 26>>


page23 explanation >>

Note that, if you call the method bind (newCustomerNodeElement) instead of addElement(newCustomerNodeElement), only the last bound node element of the type Customer is contained in the list of node elements. That is, wdContext.nodeCustomers().bind(newCustomerNodeElement) overwrites the list of node elements of the type Customer.

Is it that .. when the cardinality is 0..1 (or) 1..1>> we have to <b>bind</b> elements and when cardinality 0..n (or) 1..n >> we have to <b>addElement();</b> ??

Also i didn't get the exact advantage of a supplyFunction.

Can any1 help me out ?? explain me .. more detailedly ???

Thank u very much in advance,


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 Sep 21, 2006 at 02:03 PM


    In general, bind and addElement are interchangeable: you may either bind or addElement.

    For example, if cardinality is 0..1 you may add sole element or bind this element. If the cardinality is 0..n then you may either bind collection of elements or add elements one by one.

    Typically, bind is used when you populate node content initially, addElement is used when user adds/removes already populated node.


    Add a comment
    10|10000 characters needed characters exceeded

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.