I have a data-bound ListGrid that has an associated Timer that refreshes the ListGrid's data at a set interval. The data on the ListGrid is filtered by a Criteria.
After the response arrives and does a setData on the ListGrid, the ListGrid's Criteria is nulled and I cannot reset it useing the request's criteria (or a cached copy of the ListGrid's criteria.)
Ideally, I would like to be able to preserve the ListGrid's criteria regardless if I call setData on it. Failing that, I'd like to be able to reset the ListGrid's criteria from the Criteria used in the request.
Here is example method to reproduce the problem that I'm seeing:
I'm using the following SC_SNAPSHOT-2011-01-04/PowerEdition Deployment (built 2011-01-04), Firefox 3.6.13, Windows 7
After the response arrives and does a setData on the ListGrid, the ListGrid's Criteria is nulled and I cannot reset it useing the request's criteria (or a cached copy of the ListGrid's criteria.)
Ideally, I would like to be able to preserve the ListGrid's criteria regardless if I call setData on it. Failing that, I'd like to be able to reset the ListGrid's criteria from the Criteria used in the request.
Here is example method to reproduce the problem that I'm seeing:
Code:
private VLayout refreshCriteriaTest() { final VLayout vlayout = new VLayout(); vlayout.setMargin(10); vlayout.setWidth(400); vlayout.setHeight(200); grid = new ListGrid(); grid.setDataSource(DataSource.get("PING")); grid.setWidth100(); grid.setHeight100(); Criteria criteria = new Criteria("name", "D"); grid.setCriteria(criteria); grid.fetchData(criteria); vlayout.addMember(grid); final Timer refresher = new Timer() { @Override public void run() { DataSource ds = grid.getDataSource(); ds.setShowPrompt(false); ds.fetchData(grid.getCriteria(), new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { SC.logWarn("request criteria:" + request.getCriteria()); SC.logWarn("grid criteria:" + grid.getCriteria()); // This will null the criteria. grid.setData(response.getData()); SC.logWarn("grid criteria:" + grid.getCriteria()); grid.setCriteria(request.getCriteria()); // The criteria remains null. SC.logWarn("grid criteria:" + grid.getCriteria()); } }); } }; // Every 15 seconds for sake of example. refresher.scheduleRepeating(15000); return vlayout; }
Comment