Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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,


Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos


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.


Former Member
0 Kudos

Hi Valery,

THanks alottt for explaining!

<i>Can you also let me know the exact advantage of a supplyFunction ?????</i>



Former Member
0 Kudos

Supply functions are used to provide node elements on demand.