x5150
3 May 2007, 4:24 PM
I have a grid working using ArrayReader but I can't get the grid to work using JsonReader using,
var ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:'?gfrm=2'}),
reader: new Ext.data.JsonReader({
root: 'rows',
totalProperty: 'results',
id: 'id'
},
[
{name: 'ID', mapping: 'id', type: 'int'},
{name: 'Name', mapping: 'name', type: 'string'},
{name: 'Color', mapping: 'color', type: 'string'}
]),
// turn on remote sorting
remoteSort: true
});
Where my url is a link to a empty page except for the text output of the object in json format.
# gfrm2 page just contains the json formatted string
{"rows":[{"color":"blue","name":"Tim","id":76},{"color":"aquamarine","name":"Stacie","id":57}],"results":2}
I just get a grid with no rows. What am I doing wrong? Is using the jsonReader going to be any faster or more efficient or just better style than ArrayReader? Thanks.
var ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:'?gfrm=2'}),
reader: new Ext.data.JsonReader({
root: 'rows',
totalProperty: 'results',
id: 'id'
},
[
{name: 'ID', mapping: 'id', type: 'int'},
{name: 'Name', mapping: 'name', type: 'string'},
{name: 'Color', mapping: 'color', type: 'string'}
]),
// turn on remote sorting
remoteSort: true
});
Where my url is a link to a empty page except for the text output of the object in json format.
# gfrm2 page just contains the json formatted string
{"rows":[{"color":"blue","name":"Tim","id":76},{"color":"aquamarine","name":"Stacie","id":57}],"results":2}
I just get a grid with no rows. What am I doing wrong? Is using the jsonReader going to be any faster or more efficient or just better style than ArrayReader? Thanks.