Hello there,
maybe a dumb question which was posted before. I would like to create local (custom filled) datasource. I know that power of datasources is in additionaly server-side funcionality but this is not what im actually looking for. The reason i don't want to use simple setData method of ListGrid (or other component) is that with this approach my live filter does not work (works only with datasource). I tried many was how to properly set datasource but sometimes I don't have data duplicated, sometimes i don't have any data show. Can you please provide some simple example how to do so? Thank you
I'm adding my actual version which of course is wrong and I'm sure it has few constructs which it does not need (or do the same thing or won't do anything). I just tried to achieve what i really want various ways.
maybe a dumb question which was posted before. I would like to create local (custom filled) datasource. I know that power of datasources is in additionaly server-side funcionality but this is not what im actually looking for. The reason i don't want to use simple setData method of ListGrid (or other component) is that with this approach my live filter does not work (works only with datasource). I tried many was how to properly set datasource but sometimes I don't have data duplicated, sometimes i don't have any data show. Can you please provide some simple example how to do so? Thank you
I'm adding my actual version which of course is wrong and I'm sure it has few constructs which it does not need (or do the same thing or won't do anything). I just tried to achieve what i really want various ways.
Code:
public abstract class LocalDatasource extends DataSource { private ListGrid grid; public LocalDatasource(ListGrid grid) { this.grid = grid; setTestData(new DataClass[]{}); setClientOnly(true); } public void reloadRecords(Collection<ListGridRecord> records) { setTestData(new DataClass[]{}); for (Record record : getCacheData()) { removeData(record); grid.removeData(record); } grid.invalidateCache(); invalidateCache(); for (TableRecord record : records) { addData(record); // add all } grid.fetchData(); } }
Comment