on 06-13-2012 7:17 PM
Hi All,
In webdynpro java,I need to populate empty rows in table on click of a button "add".
I have created a instance for the tablenode and rows are getting created but the issue is it is taking the values of first row(which is entered manually).
So if I generate 5 rows, all the 5 rows are having the same value.
I tried to set the fields as blank but still doesnt work.
Can any one help me to populate empty rows?
Thanks!
prakash
Hi Prakash,
can you paste the code?
also can you expalain the details like whether you are using model node/Value node?
In simple way
When I created one node with name 'Details' and cardinality 1:n,
it is working fine with this ADD button function:
IWDNodeElement ele = wdContext.nodeDetails().createElement();
wdContext.nodeDetails().addElement(ele);
Regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Ram,
Thanks. the node is a value node and collec cardinality is 1:n
IWDNodeElement tab = wdContext.nodeTable().createAndAddTableElement();
When i click "ADD" button, rows are generating but it is taking the values of first row ( which is entered manually) . I am not setting any values in the code.
I want to generate a empty row. Help me in this
Thanks!
Prakash
Hi Swarnaprakash,
I think i know your problem. Pls check if you are mistakenly adding the first element only multiple times instead of new elements every time.
The following code seems like the right code.
IWDNodeElement ele = wdContext.nodeDetails().createElement();
wdContext.nodeDetails().addElement(ele);
For your problem, i feel that the node element that you are adding on create might mistakenly be pointing to the first element of the table and not the new node elements that you are creating.
For Example - Wrong code
//CODE STARTS HERE
IWDNodeElement ele = wdContext.nodeDetails().createElement();
ele.set<>();
else.set<>();
wdContext.nodeDetails().addElement(ele);
IWDNodeElement ele1 = wdContext.nodeDetails().createElement();
for (int i=0; i<5; i++)
{
ele1 = wdContext.nodeDetails().createElement();
ele1.set<>();
els1.set<>();
wdContext.nodeDetails().addElement(ele);
}
//CODE ENDS HERE
Note that this code creates ele1 five times but mistakenly adds ele 5 times in the for loop. In this case all nodes will show the same content as ele. You must be facing the same problem because of the minor programming error.
For Example - Right code
//CODE STARTS HERE
IWDNodeElement ele = wdContext.nodeDetails().createElement();
ele.set<>();
else.set<>();
wdContext.nodeDetails().addElement(ele);
IWDNodeElement ele1 = wdContext.nodeDetails().createElement();
for (int i=0; i<5; i++)
{
ele1 = wdContext.nodeDetails().createElement();
ele1.set<>();
els1.set<>();
wdContext.nodeDetails().addElement(ele1);
}
//CODE ENDS HERE
Hi Prakash,
By seeing the pattern, you are taking the instance of the 1st row.
Please make sure that you are crating new instance inside loop.
always check the adding element always.
wdContext.nodeDetails().addElement(<ele>);
the <ele> have some issue.
I think Amol explained it clearly.
Still you have issue let me know.
Regards,
Ram
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.