Dojo Data Stores

From Wiki
Revision as of 22:53, 31 January 2011 by Scott (talk | contribs) (Created page with ' == Source == Json-based data stores need a source (either file, a web service, or a hash object) with this format: <pre> { identifier: 'id', items: [ {id: 1, width: 50, hei…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Source

Json-based data stores need a source (either file, a web service, or a hash object) with this format:

{ identifier: 'id', items: [
    {id: 1, width: 50, height: 20},
    {id: 2, width: 10, height: 20}
    ]
}

Create a Store

var pantryStore = new dojo.data.ItemFileReadStore({ url: "pantry_items.json" });  // reads entire file into memory
var recipeStore = new dojox.data.JsonRestStore({target:"/recipeStore"});