1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    India
    Posts
    11
    Vote Rating
    0
    nuzahat sayyed is on a distinguished road

      0  

    Default Not being able to map model in JsonStore using JsonReader

    Not being able to map model in JsonStore using JsonReader


    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' },
    'CabinetName']
    });




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


    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',
    reader:iccDeviceReader
    },
    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.
    Thanks

  2. #2
    Sencha User carol.ext's Avatar
    Join Date
    Jun 2007
    Location
    Littleton, Colorado, USA
    Posts
    679
    Vote Rating
    21
    carol.ext will become famous soon enough carol.ext will become famous soon enough

      0  

    Default


    Is this a sencha touch issue too? Maybe someone can move the post if it is.

  3. #3
    Sencha User
    Join Date
    Aug 2011
    Location
    India
    Posts
    11
    Vote Rating
    0
    nuzahat sayyed is on a distinguished road

      0  

    Default


    Thanks for informing...
    I have created new post in sencha touch Q&A
    http://www.sencha.com/forum/showthre...309#post656309

Thread Participants: 1

Tags for this Thread