Creating a table from ArrayList (newbie question)
Hello all,
I've just started using Java Studio Creator 2.
What I need to do is to create a dead simple table where column entries are generated by a list. Say:
private ArrayList names = new ArrayList();
..
names.add("Peter");
names.add("Maggie");
and so on.
...
I've been searching through the forums and I found two solutions which do not work for me:
1) Changing the values of the defaultDataProvider manually: I don't know how to change table data. Seems to be complicated, am I wrong?
2) Using a List Data Provider:
listdataprovider.setList(names).
Then binding the column of the table to that listdataprovider.
Thanks a lot for your help,
Jess
# 2
I don't see how it works.
I tried following steps:
I have the Array list:
private ArrayList names = new ArrayList(2);
names.add("Peter");
names.add("Maggie");
then in the init of the pagebean:
listDataProvider.setList(names);
1) I place a "List Data Provider" somewhere in the page
2) The Properties window of listDataProvider1 shows : Data_ List names, so that seems to be fine
3) I place a table somewhere on the page
4) Under tableColumn1 -> StaticText3 I bind the text to listDataProvider
And well it doesn't work...I think step 4 is wrong. Don' understand how I can bind the thing. The problem is that the array will be generated automatically at runtime, otherwise I just could put the data in it.
Thanks for your help,
Jess