dstore's equivalent to dojo/store/JsonRest
is dstore/Rest
(however, if you don't have a compliant REST API on the server you may want to use dstore/Request
).
dstore's filter
method allows you to make arbitrary queries. It returns a collection with any applied filters stored so that they can be included whenever fetch
or fetchRange
is called.
var store = new Request({ target: '/path/to/service' });
var filteredCollection = store.filter({ y: 2015, m: 5 });
filteredCollection.fetch();
would result in the following HTTP request:
/path/to/service?y=2015&m=5
To use this functionality with dgrid 0.4, you would assign the filtered collection to the grid instance (and dgrid will handle calling fetch/fetchRange
as necessary):
grid.set('collection', store.filter({y: year, m: month}));
dgrid 0.4 and dstore introduce a significant shift in the way the grid interacts with the store. In dgrid 0.3 the grid had a much more active role in managing the query state of the store - with dgrid 0.4, this is no longer the case (hence the removal of the setQuery
method). In dgrid 0.4, it is up to code external to the grid to implement logic related to filtering store data. Whereas in dgrid 0.3 you typically set the grid's store
property a single time and call setQuery
whenever you need to filter the data, with dgrid 0.4 you set the collection
property any time you need to update the filtering. dstore's Request
store allows you to configure the parameter names for range
and sort
filtering.