cancel
Showing results for 
Search instead for 
Did you mean: 

How to bind UI Element with Context Node Attribute Element

Former Member
0 Kudos

Hi,

I'm building my view dynamically in the wdDoModifyView method.

Is it possible to bind a "TextView" element to a specific element of an attribute node?

Scenario:

Node_Employees

|

+- Attribute_Code

|

+- Attribute_Name

Node Contents:

Employees

|

+- Code: 1, Name: Employee 1

|

+- Code: 2, Name: Employee 2

|

+- Code: 3, Name: Employee 3

I need to do something like binding a TextView UI element to the "Name" attribute of the element #2, what would result to show "Employee 2" on my view.

How can I do this?

Thanks in advance,

Geraldo.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You cannot bind a property to a node element. If you bind it to an attribute of a node with cardinality 0:N, you will always get the attribute value at the lead-selected element.

Armin

Former Member
0 Kudos

Hi Armin,

Yes, that's exactly what is happening.

Regards,

Geraldo Brígido.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello, do you mind sending me an example of how you achieved this?

Former Member
0 Kudos

Hi Geraldo,

First you have to find the number of attributes of the node,then you can use any loop to get the attributes one by one and bind it to the textview using the getnodeInfo() and getChild() methods.

Kind Regards,

Saravanan K

Former Member
0 Kudos

Instead of using one Value Node I used multiple Value Attributes.

Thank you all!

Best Regards.

Geraldo Brígido.

Former Member
0 Kudos

Hi Geraldo,

Your question is binding the dynamic textview to a static context attribute? Is it Correct?

Regards

Saravanan K

Former Member
0 Kudos

Hi Saravanan,

First I populate the context node and it won't change during view's lifecycle. After that, I build my view and bind the TextView UI elements to the node context attributes elements.

If the node has 10 elements, I will build 10 TextView UI elements and bind them to each attribute element.

Regards,

Geraldo Brígido.

Former Member
0 Kudos

Hi Geraldo

To achieve wat you can apply this logic

for(int idx=0; idx < wdcontext.nodeContainingEle ; idx++)

{

create a text view element;

bind this text view element to wdcontext.nodeContainingEle.getElementAt(idx);

}

Hope it helps

Thanks and Regards

Kapil

Former Member
0 Kudos

Geraldo,

Then you have to create 10 dynamic context nodes with the same attributes (and optionaly same nested structure) but with cardinality 0..1 or 1..1.

Next you have to dynamically create 10 TextView control and bind their "text" property to corresponding attribute in every dynamic node.

VS