View Full Version : Not being able to map model in JsonStore using JsonReader

nuzahat sayyed
4 Oct 2011, 5:53 AM
Hi Guys.
I am facing a problem in sencha while mapping Ext.data.JsonStore model using Ext.data.JsonReader.

Json response from server (server model):
{"rows":[{"id":1,"firstname":"Bill"},{"id": 2,"firstname":"Ben"}]}

Model used in Json Store:
Ext.regModel( 'mycabinet', {
fields: [
{ name : 'DeviceId', type: 'int' },

json Reader code:
var iccDeviceReader = new Ext.data.JsonReader({
// metadata configuration options:
idProperty: 'id',
root: 'rows',
fields: [
{name: 'CabinetName', mapping: 'firstname'},

json store code:
app.iccDS = new Ext.data.JsonStore( {
model : 'mycabinet',
sorters : 'CabinetName',
getGroupString : function(record) { return record.get('CabinetName')[0]; },
proxy : {
type: 'ajax',
url : '/icc/js/data.js',
autoLoad: true
} );

I am expecting that "mycabinet" model will get populated with "server model". However, mapping doesnt occur.
I even tried using convert without any success(name:'DeviceId',mapping:'id',convert: function(v){return v.id;})

Any help will be highly appreciated.

4 Oct 2011, 1:59 PM
Is this a sencha touch issue too? Maybe someone can move the post if it is.

nuzahat sayyed
4 Oct 2011, 4:17 PM
Thanks for informing...
I have created new post in sencha touch Q&A