Hello all.
I created in the wdInit()
ArrayList datas = new ArrayList(); for (int i = 0; i < 25; i++) { MyData data = new MyData(); .... data.setMethods(); .... datas.add(data); } wdContext.nodeMyData().bind(datas);
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(); wdContext.nodeMyData().addElement(dynTabElem);
I get an error: com.sap.tc.webdynpro.progmodel.context.ContextException: 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.