Hi,
I am trying to refresh a listgrid without flicker. For this reason I have implemented a listgrid with a clientonly datasource. On refresh I am using a duplicate datasource without the clientOnly flag and then adding/updating/removing data as needed. However on refreshing the listgrid I get the following error:
clientOnly remove operation failed .. missing primaryKey value(s):myKey
or
add operation failed .. duplicate key in record
Any pointers why these errors are coming? They are fairly reproducible with a large dataset. They primary key is declared to be unique in the datasource.
Thanks for your help!
I am trying to refresh a listgrid without flicker. For this reason I have implemented a listgrid with a clientonly datasource. On refresh I am using a duplicate datasource without the clientOnly flag and then adding/updating/removing data as needed. However on refreshing the listgrid I get the following error:
clientOnly remove operation failed .. missing primaryKey value(s):myKey
or
add operation failed .. duplicate key in record
Code:
dataSource.fetchData(null, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { ArrayList newKeyList = new ArrayList(); Record[] recordList = response.getData(); ResultSet rs = listGrid.getResultSet(); //add and update for (int m = 0; m < recordList.length; m++) { Record rec = recordList[m]; String key = rec.getAttribute("myKey"); newKeyList.add(key); if (rs.findByKey(key) != null) listGrid.updateData(rec); else listGrid.addData(rec); } //remove for (int m = 0; m < rs.getLength(); m++) { Record rec = rs.get(m); if (!newKeyList.contains(rec.getAttribute("myKey"))) listGrid.removeData(rec); } } });
Thanks for your help!
Comment