Hi.
SmartClient Version: v9.0_2013-07-03/LGPL Development Only (built 2013-07-03), both ff and chrome
I cannot get ListGrid working with the json format described here:
http://www.smartclient.com/smartgwt/...ataSource.html
When the server response is:
I get three empty rows with no error in dev console.
But with
it shows correct two rows.
Has the format changed or do you have any idea what is causing this?
Thanks
SmartClient Version: v9.0_2013-07-03/LGPL Development Only (built 2013-07-03), both ff and chrome
I cannot get ListGrid working with the json format described here:
http://www.smartclient.com/smartgwt/...ataSource.html
Code:
public class SGwtUI implements EntryPoint { public void onModuleLoad() { VLayout main = new VLayout(); ListGrid worklistGrid = new ListGrid(); worklistGrid.setDataSource(WorklistDataSource.getInstance()); worklistGrid.setAutoFetchData(true); main.addMember(worklistGrid); main.draw(); } }
Code:
public class WorklistDataSource extends RestDataSource { public static final String ID = "worklistDS"; private static final WorklistDataSource INSTANCE = new WorklistDataSource(); public static WorklistDataSource getInstance() { return INSTANCE; } private WorklistDataSource() { setID(ID); setClientOnly(false); setFields(generateFields()); setOperationBindings(generateOperationBindings()); } private OperationBinding[] generateOperationBindings() { List<OperationBinding> operationBindings = new ArrayList<OperationBinding>(); OperationBinding fetchOB = new OperationBinding(DSOperationType.FETCH, "servlet"); fetchOB.setDataProtocol(DSProtocol.POSTPARAMS); fetchOB.setDataFormat(DSDataFormat.JSON); operationBindings.add(fetchOB); return operationBindings.toArray(new OperationBinding[operationBindings.size()]); } private DataSourceField[] generateFields() { List<DataSourceField> dsFields = new ArrayList<DataSourceField>(); DataSourceField idField = new DataSourceIntegerField("id"); idField.setPrimaryKey(true); dsFields.add(idField); DataSourceField typeField = new DataSourceTextField("code", "Type"); dsFields.add(typeField); DataSourceField startField = new DataSourceDateField("started", "Started"); dsFields.add(startField); return dsFields.toArray(new DataSourceField[dsFields.size()]); } }
Code:
{ "response":{ "status":0, "startRow":0, "endRow":1, "totalRows":2, "data":[ {"id":768,"code":"d","started":"2013-11-20T14:34:39Z"}, {"id":1242,"code":"p","started":"2013-11-20T14:34:45Z"} ]} }
But with
Code:
{ "response":{ "status":0, "startRow":0, "endRow":1, "totalRows":2, "data":{ "WHATISTHIS":[ {"id":768,"code":"d","started":"2013-11-20T14:34:39Z"}, {"id":1242,"code":"p","started":"2013-11-20T14:34:45Z"} ]} } }
Has the format changed or do you have any idea what is causing this?
Thanks
Comment