Is there a way to instantiate a DataSource from a JavaScriptObject like the following but in SmartGWT...
Since there is a constructor for DataSource which takes a JavaScriptObject, I thought all I had to do was pass the object to the constructor and it would build the DataSource with all the fields.
So I've subclassed RestDataSource and I'm passing a JSONObject to the constructor like so,
and my the JSON object looks like this:
But when I try to use the DataSource it says it isn't created.
Is it possible to create DataSources this way in SmartGWT? If so, is there a document explaining the format that DataSource's expect the JavaScriptObject to comply with? or an example somewhere?
Thanks for your help,
- Greg
Code:
isc.DataSource.create({ // json here });
So I've subclassed RestDataSource and I'm passing a JSONObject to the constructor like so,
Code:
public MyDataSource(JSONObject data) { super(data.getJavaScriptObject()); }
Code:
{ ID:"com_test_Customer", Constructor:"RestDataSource", title: "Customer", pluralTitle: "Customers", serverType: "generic", fields:{ middleName:{ title: "Middle Name", length: 30, type: "text" }, id:{ title: "Id", primaryKey: true, required: true, type: "integer" } } }
Is it possible to create DataSources this way in SmartGWT? If so, is there a document explaining the format that DataSource's expect the JavaScriptObject to comply with? or an example somewhere?
Thanks for your help,
- Greg
Comment