Skip to content

Instantly share code, notes, and snippets.

@slackorama
Created May 21, 2009 00:04
Show Gist options
  • Save slackorama/115171 to your computer and use it in GitHub Desktop.
Save slackorama/115171 to your computer and use it in GitHub Desktop.
set properties on a store from returned data
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