on 09-21-2007 1:44 PM
Hi All,
I have a parent node called "tablemain" and child node for it is "tablechild" .
This "tablechild" has a attribute called "id" .
I have a input field and "save" button in my output screen.
If I enter value in inputfield and press save button the value should be stored as 1st element in the node ""tablechild" .
After clering the value in inputfield and if I again enter a new value in that and press save button the value should be stored as a second element in the "tablechild" .The process should be continued like this.
How can I do achieve this?Please help me in this.
Thanks in advance.
Message was edited by:
Bharath Akuthota
Hi Bharath,
Try this
Each time when action is performed,
1: take the size of child node into ine variable say, len.
2: Then create childelement,afterwards set the value Id of childelement to the value of input fileld.
3: Finally add the child element to tablechild Node with index "len"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bharath,
If you want to store the input value in the "tablechild" node attribute. Why do you want to have a parent node "TableMain"?
You can make use of a single node and a attribute to do this directly.
Have a "TableMain" node alone. Inside this create an attribute "Id".
In your onClick button code:
Iprivate<View name>.I<TAbleMainnode>element ele = wdContext.create<TAbleMainnode>element();
ele.set<ID>(wdcontext.currentcontextelement().get<Input filed attribute>);
wdcontext.node<tableMainnode>().addElement(ele);
Regards,
Nagarajan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Natarajan,
Thanks for the responce.But my requirement is like that and we have some more child nodes under that main node,it is like one structure,we can not modify it now.
So please give me the code which suits for my requirement(i.e. storing data in child node under a node)
Thanks in advance.
Hi Bharath,
Follow this code in your button click:
// Get the id from the input filed
String id = wdContext.currentContextElement().get<input filed att>();
IPrivateTableComponentView.I<TAblemain>element ele1 = wdContext.create<TAblemain>element();
wdContext.node<TAblemain>().addElement(ele1);
IPrivateTableComponentView.I<TAblechild>element ele = wdContext.node<TAblemain>.node<TAblechild>.createVn_ChildElement();
ele.set<table child att>(id);
wdContext.node<TAblemain>.node<TAblechild>.addElement(ele);
Then print the size of the node and see whne u add the attributes.
wdComponentAPI.getMessageManager().reportSuccess("Size of child node "+wdcontext.node<TableChild>().size());
This will solve ur problem,
Regards,
Nagarajan.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.