Initializer for the Wikipedia data store interface.
The WikipediaStore is a data store interface to Wikipedia, using the Wikipedia SMD spec from dojox.rpc. It currently is useful only for finding articles that contain some particular text or grabbing single articles by full name; no wildcards or other filtering are supported.
Parameter | Type | Description |
---|---|---|
options | undefined |
See the dojox/data/WikipediaStore reference documentation for more information.
var store = new dojox.data.WikipediaStore(); store.fetch({ query: {title:"Dojo Toolkit"}, onItem: function(item){ dojo.byId("somediv").innerHTML = item.text["*"]; } });
This parameter is used by the ServiceStore to estimate the total count. When paging is indicated in a fetch and the response includes the full number of items requested by the fetch's count parameter, then the total count will be estimated to be estimateCountFactor multiplied by the provided count. If this is 1, then it is assumed that the server does not support paging, and the response is the full set of items, where the total count is equal to the numer of items returned. If the server does support paging, an estimateCountFactor of 2 is a good value for estimating the total count It is also possible to override _processResults if the server can provide an exact total count.
Defaults to 'id'. The name of the attribute that holds an objects id. This can be a preexisting id provided by the server. If an ID isn't already provided when an object is fetched or added to the store, the autoIdentity system will generate an id for it and add it to the index.
This is a schema object for this store. This should be JSON Schema format.
This is the service object that is used to retrieve lazy data and save results The function should be directly callable with a single parameter of an object id to be loaded
Setting this to true will set the store to using synchronous calls by default. Sync calls return their data immediately from the calling function, so callbacks are unnecessary. This will only work with a synchronous capable service.
Parameter | Type | Description |
---|---|---|
results | undefined | |
def | undefined |
Checks to see if 'item' has 'value' at 'attribute'
Parameter | Type | Description |
---|---|---|
item | Object | |
attribute | String | |
value | Anything |
Fetch a page or some partially-loaded search results from Wikipedia. Note that there isn't a way to sort data coming in from the API, so we just ignore the sort parameter.
Parameter | Type | Description |
---|---|---|
request | object |
Loading a page:
store.fetch({ query: {title:"Dojo Toolkit"}, // define your handlers here });
Searching for pages containing "dojo":
store.fetch({ query: { action: "query", text: "dojo" }, // define your handlers here });
Searching for the next 50 pages containing "dojo":
store.fetch({ query: { action: "query", text: "dojo", start: 10, count: 50 // max 500; will be capped if necessary }, // define your handlers here });
fetch an item by its identity, by looking in our index of what we have loaded
Parameter | Type | Description |
---|---|---|
args | undefined |
Gets the available attributes of an item's 'property' and returns it as an array.
Parameter | Type | Description |
---|---|---|
item | Object |
returns the attributes which are used to make up the identity of an item. Basically returns this.idAttribute
Parameter | Type | Description |
---|---|---|
item | undefined |
returns the label for an item. Just gets the "label" attribute.
Parameter | Type | Description |
---|---|---|
item | undefined |
returns an array of attributes that are used to create the label of an item
Parameter | Type | Description |
---|---|---|
item | undefined |
Returns a reference to the JSON Schema
Gets the value of an item's 'property'
Parameter | Type | Description |
---|---|---|
item | Object | The item to get the value from |
property | String | property to look up value for |
defaultValue | value |
Optional the default value |
Gets the value of an item's 'property' and returns it. If this value is an array it is just returned, if not, the value is added to an array and that is returned.
Parameter | Type | Description |
---|---|---|
item | Object | |
property | String | property to look up value for |
Checks to see if item has attribute
Parameter | Type | Description |
---|---|---|
item | Object | |
attribute | String |
Checks to see if the argument is an item
Parameter | Type | Description |
---|---|---|
item | Object |
Checks to see if the item is loaded.
Parameter | Type | Description |
---|---|---|
item | object |
Loads an item and calls the callback handler. Note, that this will call the callback handler even if the item is loaded. Consequently, you can use loadItem to ensure that an item is loaded is situations when the item may or may not be loaded yet. If you access a value directly through property access, you can use this to load a lazy value as well (doesn't need to be an item).
Parameter | Type | Description |
---|---|---|
args | undefined |
store.loadItem({ item: item, // this item may or may not be loaded onItem: function(item){ // do something with the item } });