dojo/data/ObjectStore
Summary
A Dojo Data implementation that wraps Dojo object stores for backwards compatibility.
Usage
(options);
Parameter | Type | Description |
---|---|---|
options | undefined |
The configuration information to pass into the data store.
The object store to use as the source provider for this data store |
See the dojo/data/ObjectStore reference documentation for more information.
Properties
labelProperty
Defined by: dojo/data/ObjectStore
objectStore
Defined by: dojo/data/ObjectStore
Methods
changing
(object,_deleting)
Defined by dojo/data/ObjectStore
adds an object to the list of dirty objects. This object contains a reference to the object itself as well as a cloned and trimmed version of old object for use with revert.
Parameter | Type | Description |
---|---|---|
object | Object |
Indicates that the given object is changing and should be marked as dirty for the next save |
_deleting | Boolean |
close
(request)
Defined by dojo/data/ObjectStore
See dojo/data/api/Read.close()
Parameter | Type | Description |
---|---|---|
request | undefined |
Returns: undefined
containsValue
(item,attribute,value)
Defined by dojo/data/ObjectStore
Checks to see if 'item' has 'value' at 'attribute'
Parameter | Type | Description |
---|---|---|
item | Object |
The item to check |
attribute | String |
The attribute to check |
value | Anything |
The value to look for |
Returns: boolean
deleteItem
(item)
Defined by dojo/data/ObjectStore
deletes item and any references to that item from the store.
Parameter | Type | Description |
---|---|---|
item | undefined |
item to delete |
emit
(type,event)
Defined by dojo/Evented
Parameter | Type | Description |
---|---|---|
type | undefined | |
event | undefined |
Returns: undefined
fetch
(args)
Defined by dojo/data/ObjectStore
See dojo/data/api/Read.fetch()
Parameter | Type | Description |
---|---|---|
args | undefined |
Returns: undefined
fetchItemByIdentity
(args)
Defined by dojo/data/ObjectStore
fetch an item by its identity, by looking in our index of what we have loaded
Parameter | Type | Description |
---|---|---|
args | undefined |
Returns: undefined
getAttributes
(item)
Defined by dojo/data/ObjectStore
Gets the available attributes of an item's 'property' and returns it as an array.
Parameter | Type | Description |
---|---|---|
item | Object |
Returns: Array
getFeatures
()
Defined by dojo/data/ObjectStore
return the store feature set
Returns: object
getIdentity
(item)
Defined by dojo/data/ObjectStore
returns the identity of the given item See dojo/data/api/Read.getIdentity()
Parameter | Type | Description |
---|---|---|
item | undefined |
Returns: undefined
getIdentityAttributes
(item)
Defined by dojo/data/ObjectStore
returns the attributes which are used to make up the identity of an item. Basically returns this.objectStore.idProperty See dojo/data/api/Read.getIdentityAttributes()
Parameter | Type | Description |
---|---|---|
item | undefined |
Returns: Array
getLabel
(item)
Defined by dojo/data/ObjectStore
See dojo/data/api/Read.getLabel()
Parameter | Type | Description |
---|---|---|
item | dojo/data/api/Item |
Returns: undefined
getLabelAttributes
(item)
Defined by dojo/data/ObjectStore
See dojo/data/api/Read.getLabelAttributes()
Parameter | Type | Description |
---|---|---|
item | dojo/data/api/Item |
Returns: Array
getValue
(item,property,defaultValue)
Defined by dojo/data/ObjectStore
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 |
Returns: value
the default value
getValues
(item,property)
Defined by dojo/data/ObjectStore
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 |
Returns: Array
hasAttribute
(item,attribute)
Defined by dojo/data/ObjectStore
Checks to see if item has attribute
Parameter | Type | Description |
---|---|---|
item | Object |
The item to check |
attribute | String |
The attribute to check |
Returns: boolean
isDirty
(item)
Defined by dojo/data/ObjectStore
returns true if the item is marked as dirty or true if there are any dirty items
Parameter | Type | Description |
---|---|---|
item | Object |
The item to check |
Returns: boolean | undefined
isItem
(item)
Defined by dojo/data/ObjectStore
Checks to see if the argument is an item
Parameter | Type | Description |
---|---|---|
item | Object |
The item to check |
Returns: boolean
isItemLoaded
(item)
Defined by dojo/data/ObjectStore
Checks to see if the item is loaded.
Parameter | Type | Description |
---|---|---|
item | Object |
The item to check |
Returns: undefined
loadItem
(args)
Defined by dojo/data/ObjectStore
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 | Object |
See dojo/data/api/Read.fetch() |
Returns: undefined
Examples
Example 1
store.loadItem({
item: item, // this item may or may not be loaded
onItem: function(item){
// do something with the item
}
});
newItem
(data,parentInfo)
Defined by dojo/data/ObjectStore
adds a new item to the store at the specified point. Takes two parameters, data, and options.
Parameter | Type | Description |
---|---|---|
data | Object |
See dojo/data/api/Write.newItem() |
parentInfo | undefined |
Returns: Object
See dojo/data/api/Write.newItem()
on
(type,listener)
Defined by dojo/Evented
Parameter | Type | Description |
---|---|---|
type | undefined | |
listener | undefined |
Returns: undefined
revert
()
Defined by dojo/data/ObjectStore
returns any modified data to its original state prior to a save();
save
(kwArgs)
Defined by dojo/data/ObjectStore
Saves the dirty data using object store provider. See dojo/data/api/Write for API.
Parameter | Type | Description |
---|---|---|
kwArgs | undefined |
|
setValue
(item,attribute,value)
Defined by dojo/data/ObjectStore
sets 'attribute' on 'item' to 'value' See dojo/data/api/Write.setValue()
Parameter | Type | Description |
---|---|---|
item | undefined | |
attribute | undefined | |
value | undefined |
setValues
(item,attribute,values)
Defined by dojo/data/ObjectStore
sets 'attribute' on 'item' to 'value' value must be an array. See dojo/data/api/Write.setValues()
Parameter | Type | Description |
---|---|---|
item | undefined | |
attribute | undefined | |
values | undefined |
unsetAttribute
(item,attribute)
Defined by dojo/data/ObjectStore
unsets 'attribute' on 'item' See dojo/data/api/Write.unsetAttribute()
Parameter | Type | Description |
---|---|---|
item | undefined | |
attribute | undefined |
Events
onDelete
()
Defined by: dojo/data/ObjectStore
See dojo/data/api/Notification.onDelete()
Examples
Example 1
store.loadItem({
item: item, // this item may or may not be loaded
onItem: function(item){
// do something with the item
}
});
onFetch
(results)
Defined by: dojo/data/ObjectStore
Called when a fetch occurs
Parameter | Type | Description |
---|---|---|
results | undefined |
Examples
Example 1
store.loadItem({
item: item, // this item may or may not be loaded
onItem: function(item){
// do something with the item
}
});
onNew
()
Defined by: dojo/data/ObjectStore
See dojo/data/api/Notification.onNew()
Examples
Example 1
store.loadItem({
item: item, // this item may or may not be loaded
onItem: function(item){
// do something with the item
}
});
onSet
()
Defined by: dojo/data/ObjectStore
See dojo/data/api/Notification.onSet()
Examples
Example 1
store.loadItem({
item: item, // this item may or may not be loaded
onItem: function(item){
// do something with the item
}
});
© 2005–2017 JS Foundation
Licensed under the AFL 2.1 and BSD 3-Clause licenses.
http://dojotoolkit.org/api/1.10/dojo/data/ObjectStore.html