on 04-09-2008 3:11 PM
HI Team,
I am trying to display 10 rows, with 3 cols in a table.
but it is displaying only last row.
this is the code is wrote.
for(int i=1;i<=10;i++)
{
wdContext.nodeEmpDetails().invalidate();
wdContext.nodeEmpDetails().currentEmpDetailsElement().setEmpId(500+i);
wdContext.nodeEmpDetails().currentEmpDetailsElement().setEmpName("Emp Name :"+i);
wdContext.nodeEmpDetails().currentEmpDetailsElement().setSalary(10000+i);
wdComponentAPI.getComponent().getMessageManager().reportSuccess(" Value..."+ i );
}
And bounded this node attributes to table cols.
when i print them i am getting all the values.
But the table is displaying only last row.
cardinality is 1--n
selction is 0-1
How can display all 10 rows in table
Regards,
Naresh
Hi Naresh,
Put this wdContext.nodeEmpDetails().invalidate();
before loop.
invalidate() method clears the data in the value node,
if you put this statement in the loop each time in the loop the previous data is being cleared so you are able to see only final iteration data.
regards,
Siva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
use this code.
for(int i=0;i<10;i++){
IEmpDetailsElement inventor = wdContext.createEmpDetailsElement();
inventor.setEmpId(500+i);
inventor.setEmployeeName("Name"+i);
inventor.setSalary(10000+i);
wdContext.nodeInventor().addElement(inventor);
}
u have import the IprivateEmpDetailsElement.
For Import press ctrlshiftO;
or right click >source>Organize imports
thanks and regards
fazal
Edited by: fazal ahamed on Apr 9, 2008 4:29 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Naresh,
To explain further,
You are actually manipulating the same element of Node EmpDetails. To create 10 records you have to create 10 elements for the node. Then for each of the element set the respective values. Also for this code make node cardinality as 0..n otherwise instead of 10 records, you will see 11 records with first record having no value.
Regards,
Gopal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
wdContext.nodeEmpDetails().invalidate(); will clear all the data in the nodeEmpDetails.
put wdContext.nodeEmpDetails().invalidate() before for loop as to clear the node for the first time and then you can add elements.
you can refer the following code too.
wdContext.nodeEmpDetails().invalidate();
IPrivate<view>View.IEmpDetailsElement element;
for(int i=1;i<=10;i++)
{
element = wdContext.createEmpDetailsElement();
element.setEmpId(500+i);
element.setEmpName("Emp Name :"+i);
element.setSalary(10000+i);
wdContext.nodeEmpDetails().addElement(element);
}
- nikhiL
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Naresh,
Instead of
for(int i=1;i<=10;i++)
{
wdContext.nodeEmpDetails().invalidate();
wdContext.nodeEmpDetails().currentEmpDetailsElement().setEmpId(500+i);
wdContext.nodeEmpDetails().currentEmpDetailsElement().setEmpName("Emp Name :"+i);
wdContext.nodeEmpDetails().currentEmpDetailsElement().setSalary(10000+i);
wdComponentAPI.getComponent().getMessageManager().reportSuccess(" Value..."+ i );
}
put following
for(int i=1;i<=10;i++)
{
wdContext.nodeEmpDetails().addElement(wdContext.nodeEmpDetails().createEmpDetailsElement());
wdContext.nodeEmpDetails().moveLast();
wdContext.nodeEmpDetails().currentEmpDetailsElement().setEmpId(500+i);
wdContext.nodeEmpDetails().currentEmpDetailsElement().setEmpName("Emp Name :"+i);
wdContext.nodeEmpDetails().currentEmpDetailsElement().setSalary(10000+i);
wdComponentAPI.getComponent().getMessageManager().reportSuccess(" Value..."+ i );
}
wdContext.nodeEmpDetails().moveFirst(0);
Regards.
Gopal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.