on 10-03-2008 9:18 AM
Hi all
Can any body send the sample code on how to store Table UI element in Arraylist.
Regards
Suresh babu
Hi I am providing two methods of it. Just go through and try. This will defenately solve your problem
I. METHOD
Try This
//@@begin others
//this is the array used in the program
String emp[][]=
{
{"nikhil","tapkir","pune"},
{ "juhi","bhatnagar","delhi"},
};
//@@end
}
i have to insert the above information in a table wid columns firstname lastname and city .
u need to use the for loop to insert the data in the table for more than 1 record
code the following thing in wd init
here fname lname and city are my value attributes mapped to my table columns.
for (int i=0;i<emp.length;i++)
{
IPrivateTabappView.ITablenodeElement tnode=wdContext.createTablenodeElement();
tnode.setFname(this.emp<i>[0]);
tnode.setLname(this.emp<i>[1]);
tnode.setCity(this.emp<i>[2]);
wdContext.nodeTablenode().addElement(tnode);
}
i hope this is what ur doubt was if not pls clarify.
hope this helps u.
II METHOD
For example: Consider that the value node DataNode having two attributes A and B is bound to the DataSource property of your Table UI Element.
IDataNodeElement objDataNode = null;
ArrayList arlDataNode = null;
int size = 0;
size = <No. of rows that you want in the table>;
arlDataNode = new ArrayList();
for(int i=0;i<size;i++)
{
objDataNode = wdContext.createDataNodeElement();
objDataNode.setA(<Set some values>);
objDataNode.setB(<Set some values>);
arlDataNode.add(objDataNode);
}
wdContext.nodeDataNode.bind(arlDataNode);
Hope, You can resolve your problem. Revert me if you have any doubts.
Regards
Raghu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.