1. #1
    Sencha User
    Join Date
    Apr 2010
    Posts
    26
    Vote Rating
    0
    Vinni is on a distinguished road

      0  

    Default recordType equivalent in ExtJS 4.1 API

    recordType equivalent in ExtJS 4.1 API


    Hi,

    Please let me know whats the equivalent for below recordType and Store in ExtJS 4.1 API.

    ExtJS 3.4
    Code:
    var recordType = new Ext.data.Record.create([
        {name: 'received', mapping: 'alarm-time'},
        {name: 'severity', mapping: 'alarm-class'},
        {name: 'description', mapping:'alarm-description'},
        {name: 'time-ms', mapping:'alarm-time/@junos:seconds'}
    ]);
    
    // reader
    var reader = new Ext.data.XmlReader({
        record: 'alarm-detail'
    }, recordType);
    
    var dataStore = new Ext.data.Store({
             allRecords : null,
             reader : reader,
             model: 'recordType',
             load : function(o){   }
    });
    ExtJS 4.1 - I tried below piece of code
    Code:
    Ext.define('recordType', {
        extend: 'Ext.data.Model',
        fields: [
            {name: 'received', mapping: 'alarm-time'},
            {name: 'severity', mapping: 'alarm-class'},
            {name: 'description', mapping:'alarm-description'},
            {name: 'time-ms', mapping:'alarm-time/@junos:seconds'}
        ]
    });
    
    var dataStore = Ext.create('Ext.data.Store', {     
    storeId: 'dataStore',     
    model: 'recordType',     
    proxy: {         
        type: 'memory',         
        reader: 'array'     }
        load : function(o){   } 
    });
    Thanks,
    Vinamra

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    15,095
    Vote Rating
    97
    evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold

      0  

    Default


    recordType is the model.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Apr 2010
    Posts
    26
    Vote Rating
    0
    Vinni is on a distinguished road

      0  

    Default


    I am already using model now but its giving error.
    Not sure if I am using ExtJS 4.1 API correctly.

    Thanks,
    Vinni