Skip to Content
Former Member
Mar 01, 2007 at 01:35 AM

How to add a new Element to the Context


Hello all.

I created in the wdInit()

ArrayList datas = new ArrayList();
	for (int i = 0; i < 25; i++) {
		MyData data = new MyData();

Now, I want by clicking on the Button "Create new Element", forward user to the other View, which elements are connected with the same model -> context, the new element should be added to context, the user should fill the form and click Save-Button.

How can I add a new Element to the Collection I created and choose it as a current element?

If I do: wdContext.nodeMyData().bind(new MyData()) all information will be lost. And I will have only one field.

If I do it like this:

IWDNodeElement dynTabElem=(IWDNodeElement)wdContext.nodeMyData().createElement();

I get an error: NodeInfo(DataComp.MyData): value node is created without a reference

Well I can pass to my new View a Collection as a parameter and then

Collection.add(new MyData()) and then bind it. But I find this solution not good.

Is there any possibility to get the existing Collection from the Context without passing it to the view?

Can I just add a new element to the existing collection?

Thanks in advance.