How can I reset a criteria in a way so that it is used the next time fetch is called (for example when the user scrolls the grid), but without calling the server with the new criteria when you set it?
I have the following data source declaration (slimmed down by removing the update urls and such):
public class InstanceDataSource extends RestDataSource
{
private static final String FETCH_URL = "myFetchUrl";
public InstanceDataSource()
{
DataSourceField nameField = new DataSourceField("name", FieldType.TEXT, "Name");
DataSourceField idField = new DataSourceField("id", FieldType.TEXT, "Id");
idField.setPrimaryKey(true);
idField.setHidden(true);
this.setFields(idField, nameField);
this.setDataFormat(DSDataFormat.JSON);
this.setFetchDataURL(FETCH_URL);
this.setClientOnly(false);
}
}
A service that will return something like this (Trimmed. Will contain at most 75 data entries):
{"response":
{"status":"0",
"startRow":"776",
"endRow":"851",
"totalRows":"1034",
"data":[
{"id":"poisson",
"name":"Poisson"},
{"id":"pong",
"name":"Pong"},
{"id":"pony-express-rider",
"name":"Pony Express Rider"},
{"id":"preziosilla",
"name":"Preziosilla"},
{"id":"prince-de-bouillon",
"name":"Prince de Bouillon"},
{"id":"prince-of-persia",
"name":"Prince of Persia"} ] }}
The following code manages the fetch that is triggered by user input, not scrolling:
grid.fetchData(new Criteria("params", "A"), new DSCallback()
{
public void execute(DSResponse response, Object rawData, DSRequest request) {
grid.setFilterEditorCriteria(new Criteria("params", "B");
}});
My problem is that the criteria doesn’t get reset to what I want it to, it stays set to the first fetch criteria. Can anyone help me?
I’m using the latest build of SmartGwt, am on a windows 7 machine and am running in development mode from Eclipse 3.5.1.