Created
May 21, 2009 00:04
-
-
Save slackorama/115171 to your computer and use it in GitHub Desktop.
set properties on a store from returned data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dojo.require('dojo.data.ItemFileReadStore'); | |
// get items from the returned data...is there a better way? | |
dojo.declare( 'MyDataStore', dojo.data.ItemFileWriteStore, { | |
_getItemsFromLoadedData: function(dataObject) { | |
this.totalCount = dataObject.totalCount; | |
this.inherited(arguemnts); | |
} | |
}); | |
var data = { identifier: "id", | |
label: "name", | |
totalCount: 42, | |
items: [ { id: 1, name: "Foobar" } ] }; | |
var store = new MyDataStore( { data: data }); | |
store.fetch( { onComplete: function(data) { console.log('o hai') }}); | |
console.log( store.totalCount ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment