Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Apr 2013
    Posts
    15
    Answers
    1
    Vote Rating
    1
    fhisg is on a distinguished road

      1  

    Default Answered: How to implement custom JSON reader

    Answered: How to implement custom JSON reader


    My ST2 app needs to consume JSON in an odd format. None of the examples in JSON and Reader docs give hints as for how to implement a custom reader.

    I have a model like so:
    Code:
    Ext.define('StationData', {
      extend: 'Ext.data.Model',
      fields: [
        {name: 'id', type: 'string'},
        {name: 'name', type: 'string'} ,
        {name: 'lat', type: 'string'},
        {name: 'long', type: 'string'},
        {name: 'foo', type: 'int'}
      ]
    });
    The JSON is like so:
    Code:
    { "66000" : // needs to be mapped to 'id'
        {
          "lat" : "nn.nnnn",
          "lon" : "nn.nnnn", // needs to be mapped to 'long'
          "name" : "Foo",
          "f" : "19", // needs to be mapped to 'foo'
          ...
        },
      "66010" : 
       {....
    How do I go about this?

  2. Extend the Json reader and use the getResponseData method

    Code:
    Ext.define('MyReader', {
        extend : 'Ext.data.reader.Json',
        alias : 'reader.myreader',
    
        getResponseData : function(response) {
            var data = this.callParent([response]);
    
            //do stuff here
    
            return data;
        }
    });

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,519
    Answers
    3447
    Vote Rating
    813
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Extend the Json reader and use the getResponseData method

    Code:
    Ext.define('MyReader', {
        extend : 'Ext.data.reader.Json',
        alias : 'reader.myreader',
    
        getResponseData : function(response) {
            var data = this.callParent([response]);
    
            //do stuff here
    
            return data;
        }
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread