cancel
Showing results for 
Search instead for 
Did you mean: 

how instantiate dynamically created node in view and mapped to a model node

Former Member
0 Kudos

Hi all,

I have dynamically created a node in a view and mapped it to some model node in the component controller (Thanks to Vijith kumar, see last thread created by me).

Also i created UI elements dynamically and binded it to the same dynamically created node in View controller.

All of this code is in wdModifyView().

Now when i access this node thru this

IWDNode node =wdContext.wdGetAPI().getRootNode().getChildNode("Activity",IWDNode.LEAD_SELECTION);

//node has the correct value "Activity" i checked thru debugging

And bind a collection of Activity objects thru this

<b>node.bind(colact);</b> // throw NullPointerException

i get the NullPointerException

i think 'node' should be instantiated first then i must call bind method.But i don't know how.

Anyone has some idea.

plz help

Rgds,

Vilish

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Obviously the variable

node 

is NULL when the bind-statement is exectued.

Where do you call this code? Is the new node already created at this point in time?

Instead of

wdContext.wdGetAPI().getRootNode()

you can simply use

wdContext

And again: Do you really need to create nodes, UI elements and data bindings at runtime? Can you please write a few words about your use case?

Armin

Former Member
0 Kudos

Thanks Armin,

i have solved the problem. you provided a very good resource.

Rgds,

Vilish