dojox.data.QueryReadStore
dojo.require("dojox.data.QueryReadStore");
defined in dojox/data/QueryReadStore.js
This class provides a store that is mainly intended to be used for loading data dynamically from the server, used i.e. for retreiving chunks of data from huge data stores on the server (by server-side filtering!). Upon calling the fetch() method of this store the data are requested from the server if they are not yet loaded for paging (or cached). For example used for a combobox which works on lots of data. It can be used to retreive the data partially upon entering the letters "ac" it returns only items like "action", "acting", etc. note: The field name "id" in a query is reserved for looking up data by id. This is necessary as before the first fetch, the store has no way of knowing which field the server will declare as identifier. examples: // The parameter "query" contains the data that are sent to the server. var store = new dojox.data.QueryReadStore({url:'/search.php'}); store.fetch({query:{name:'a'}, queryOptions:{ignoreCase:false}}); // Since "serverQuery" is given, it overrules and those data are // sent to the server. var store = new dojox.data.QueryReadStore({url:'/search.php'}); store.fetch({serverQuery:{name:'a'}, queryOptions:{ignoreCase:false}});
todo: - there is a bug in the paging, when i set start:2, count:5 after an initial fetch() and doClientPaging:true it returns 6 elemetns, though count=5, try it in QueryReadStore.html - add optional caching - when the first query searched for "a" and the next for a subset of the first, i.e. "ab" then we actually dont need a server request, if we have client paging, we just need to filter the items we already have that might also be tooo much logic
parameter | type | description |
---|
params | Object | |
Only private and/or inherited functions are available.
See dojo.data.api.Identity.fetchItemByIdentity() See if we have already loaded the item with that id In case there hasn't been a fetch yet, _itemsByIdentity is null and thus a fetch will be triggered below.
See dojo.data.api.Identity.getIdentity()
See dojo.data.api.Identity.getIdentityAttributes()
See dojo.data.api.Read.getLabel()
See dojo.data.api.Read.getLabelAttributes()
See dojo.data.api.Read.hasAttribute()
This function tests whether the item passed in is indeed a valid 'attribute' like type for the store.
It throws an error if item is not valid, so you can call it in every method that needs to throw an error when item is invalid.
The request contains the data as defined in the Read-API. Additionally there is following keyword "serverQuery". The *serverQuery* parameter, optional. This parameter contains the data that will be sent to the server. If this parameter is not given the parameter "query"'s data are sent to the server. This is done for some reasons: - to specify explicitly which data are sent to the server, they might also be a mix of what is contained in "query", "queryOptions" and the paging parameters "start" and "count" or may be even completely different things. - don't modify the request.query data, so the interface using this store can rely on unmodified data, as the combobox dijit currently does it, it compares if the query has changed - request.query is required by the Read-API I.e. the following examples might be sent via GET: fetch({query:{name:"abc"}, queryOptions:{ignoreCase:true}}) the URL will become: /url.php?name=abc fetch({serverQuery:{q:"abc", c:true}, query:{name:"abc"}, queryOptions:{ignoreCase:true}}) the URL will become: /url.php?q=abc&c=true // The serverQuery-parameter has overruled the query-parameter // but the query parameter stays untouched, but is not sent to the server! // The serverQuery contains more data than the query, so they might differ!
If the data from servers needs to be processed before it can be processed by this store, then this function should be re-implemented in subclass. This default implementation just return the data unchanged.
Only private and/or inherited properties are available.