View Full Version : How do i use a custom data store???

28 Jan 2010, 12:56 PM
I have the following code which I have peiced togather by reading threads, articles, etc...

var store_record = Ext.data.Record.create([{name: 'id', mapping: 0}, {name: 'name', mapping: 1}]);

var store_reader = new Ext.data.JsonReader({
root: 'rows',
totalProperty: 'results'
}, store_record);

var store_status = new Ext.data.Store({
autoLoad: true,
reader: store_reader,
proxy: new Ext.data.HttpProxy({
url: 'services/index.php/application/status/list'


From what I can tell after this I should be able too iterate store_status.data.item but it's blank in FireBug???

The PHP script is returnin a JSON array in the simple form:


What am I missing? What steps are needed or extraneous (in the above) to accomplish such a simple thing?

I want to iterate this array and build a menu list from it, while associating an event handler to each item as I go...


28 Jan 2010, 1:33 PM
Did you try the ArrayReader rather than JsonReader?

28 Jan 2010, 5:25 PM
I think I figured it out just as I was leaving work...will try again tomorrow but I think the only difference was:

var store_reader = new Ext.data.JsonReader({
totalProperty: 'total',
root: 'results'

{name: 'id', mapping: '0'},
{name: 'name', mapping: '1'}

Which seemed to cause the data store load to fire anyways - so now it's a matter of initializing an array and iterating that array to populate an menu drop down...