Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Using DataSource without binding to a xml file or a DB

$
0
0
Can I use a DataSource but not bind to any xml file or DB?

I try to use the addData method of DataSource but cannot see any data.

What I have is below:
DataSource ds = new DataSource();
ds.setID("somestring");

DataSourceTextField pkField = new DataSourceTextField("primarykey");
pkField.setHidden(true);
pkField.setPrimaryKey(true);

DataSourceTextField countryCodeField = new DataSourceTextField("countryCode", "Code");
countryCodeField.setRequired(true);

ds.setFields(pkField, countryCodeField);

ds.setClientOnly(true);

ListGrid table = new ListGrid();
table.setDataSource(ds);

ListGridRecord record = new ListGridRecord();
record.setAttribute("primarykey", "123");
record.setAttribute("countryCode", "AAA");
ds.addData(record);

------------------
Then when I test this, I only see the table header, but no data at all.
Do I miss anything?


Thanks,

Viewing all articles
Browse latest Browse all 4756

Trending Articles