This class provides a store that is mainly intended to be used for loading data dynamically from the server, used i.e. for retrieving 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 retrieve 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.
Parameter | Type | Description |
---|---|---|
params | Object |
See the dojox/data/QueryReadStore reference documentation for more information.
// 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}}); <div dojoType="dojox.data.QueryReadStore" jsId="store2" url="../tests/stores/QueryReadStore.php" requestMethod="post"></div> <div dojoType="dojox.grid.data.DojoData" jsId="model2" store="store2" sortFields="[{attribute: 'name', descending: true}]" rowsPerPage="30"></div> <div dojoType="dojox.Grid" id="grid2" model="model2" structure="gridLayout" style="height:300px; width:800px;"></div>
By default every request for paging is sent to the server.
By default all the sorting is done serverside before the data is returned which is the proper place to be doing it for really large datasets.
This function tests whether the item passed in is indeed a valid 'attribute' like type for the store.
Parameter | Type | Description |
---|---|---|
attribute | attribute-name-string | The attribute to test for being contained by 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.
Parameter | Type | Description |
---|---|---|
item | item | The item to test for being contained by the store. |
The request contains the data as defined in the Read-API. Additionally there is following keyword "serverQuery".
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:
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!
Parameter | Type | Description |
---|---|---|
request | undefined | |
fetchHandler | undefined | |
errorHandler | undefined |
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.
Parameter | Type | Description |
---|---|---|
data | undefined | The data received from server |
The data received from server
Parameter | Type | Description |
---|---|---|
data | undefined | |
request | undefined | |
fetchHandler | undefined | |
errorHandler | undefined |
Parameter | Type | Description |
---|---|---|
request | dojo/data/api/Request | Object |
Optional
|
Parameter | Type | Description |
---|---|---|
item | item | |
attribute | attribute-name-string | |
value | anything |
See dojo.data.util.simpleFetch.fetch() this is just a copy and I adjusted only the paging, since it happens on the server if doClientPaging is false, thx to http://trac.dojotoolkit.org/ticket/4761 reporting this. Would be nice to be able to use simpleFetch() to reduce copied code, but i dont know how yet. Ideas please!
Parameter | Type | Description |
---|---|---|
request | Object |
Optional
|
See dojo/data/api/Identity.fetchItemByIdentity()
Parameter | Type | Description |
---|---|---|
keywordArgs | Object |
See dojo/data/api/Identity.getIdentity()
Parameter | Type | Description |
---|---|---|
item | item |
See dojo/data/api/Identity.getIdentityAttributes()
Parameter | Type | Description |
---|---|---|
item | item |
See dojo/data/api/Read.getLabel()
Parameter | Type | Description |
---|---|---|
item | item |
See dojo/data/api/Read.getLabelAttributes()
Parameter | Type | Description |
---|---|---|
item | item |
Parameter | Type | Description |
---|---|---|
item | item | |
attribute | attribute-name-string | |
defaultValue | value |
Optional
|
Parameter | Type | Description |
---|---|---|
item | item | |
attribute | attribute-name-string |
See dojo/data/api/Read.hasAttribute()
Parameter | Type | Description |
---|---|---|
item | item | |
attribute | attribute-name-string |
Parameter | Type | Description |
---|---|---|
something | anything |