I'm trying to populate a client only datasource and show it in a grid. I create it with new DataSource(), setClientOnly(true), create a DataSourceField and setPrimaryKey(true) then addField() and add a few others. I then create a few new Record() objects and use setAttribute() to set the field values and use DataSource.addData(myRecord) to fill the data source. Finally I define a ListGrid and setDataSource() to my new data source. It all seems to work fine except that the grid shows up empty. So I add grid.setAutoFetchData(true) and I get a series of runtime errors telling me that ...
java.lang.ClassCastException: com.smartgwt.client.data.Record cannot be cast to com.smartgwt.client.widgets.grid.ListGridRecord
It seems I have to add ListGridRecords to the data source instead of just Records. If I make that change the data appears. But what if I then want to bind some other type of UI widget to the same data source.
I thought a DataSource just contains Records, not specifically ListGridRecords. What am I misunderstanding?
java.lang.ClassCastException: com.smartgwt.client.data.Record cannot be cast to com.smartgwt.client.widgets.grid.ListGridRecord
It seems I have to add ListGridRecords to the data source instead of just Records. If I make that change the data appears. But what if I then want to bind some other type of UI widget to the same data source.
I thought a DataSource just contains Records, not specifically ListGridRecords. What am I misunderstanding?
Comment