Skip to content

Instantly share code, notes, and snippets.

@jjulian
Created February 13, 2010 19:16
Show Gist options
  • Save jjulian/303634 to your computer and use it in GitHub Desktop.
Save jjulian/303634 to your computer and use it in GitHub Desktop.
var ourStore = new Ext.data.JsonStore({ //change to JsonStore
url:'Chapter15Example.json',
root:'files', //add root here
fields: [ //add fields here
{name:'file_name',mapping:'name'},
{name:'file_size',mapping:'size',type:'int'},
'type',
{name:'lastmod',mapping:'datelastmodified',type:'date'},
{name:'file_attributes',mapping:'attributes'}, //these last few fields are not in the source json
'mode',
'directory'
],
baseParams:{ //note to reader that this defaults to a POST
method: 'getFileInfoByPath',
returnFormat: 'JSON',
queryFormat: 'column',
startPath: '/images/'
},
listeners:{
load: function(store,records,options){
console.log(records);
},
exception: function(proxy,type,action,options,response,arg) {
console.log(arguments); //added to watch what was going wrong
}
}
});
ourStore.load({
params:{startPath:'/foo'} // you don't need to assign baseParams in 'beforeload' - the load() method does it for you
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment