1. #1
    Sencha User
    Join Date
    Jun 2010
    Location
    india
    Posts
    13
    Vote Rating
    0
    arunsathyan is on a distinguished road

      0  

    Default Loading Json in Store to display it on List Sencha Touch 2

    Loading Json in Store to display it on List Sencha Touch 2


    i am not able to load data from store to List.
    My Code
    Code:
    Ext.define('Contact', {
        extend: 'Ext.data.Model',
        config: {
           idProperty: 'CompanyCode',
        fields: [
            { name: 'CompanyCode', type: 'string' },
            { name: 'LastTradedPrice', type: 'string' },
            { name: 'PercentageDiff', type: 'string' },
            { name: 'FiftyTwoWeekHigh', type: 'string' },
            { name: 'FiftyTwoWeekLow', type: 'string' },
            { name: 'ChangePercent', type: 'string' },
            { name: 'Change', type: 'string' },
            { name: 'MarketCap', type: 'string' },
            { name: 'High', type: 'string' },
            { name: 'Low', type: 'string' },
            { name: 'PrevClose', type: 'string' },
            { name: 'OpenInterest', type: 'string' },
            { name: 'MarketLot', type: 'string' },
            { name: 'ChangeInOpenInterest', type: 'string' },
            { name: 'LastTradedTime', type: 'date', dateFormat: 'c' }
        ]
        }
    });
    
    
    var store = Ext.create('Ext.data.Store', {
         extend: ["Ext.data.proxy.JsonP"],
       model: Contact,
       sorters: 'CompanyCode',
    
    
       grouper: {
           groupFn: function(record) {
               return record.get('CompanyCode')[0];
           }
       },
    
    
       proxy : {
                type : 'jsonp',
                url : 'http://money.rediff.com/money1/current_status_new.php?companylist=17023928|17023929&id=1354690151&Rand=0.6305125835351646',
                 callbackKey: 'callback',
                reader:{
                        type:'json',
                        rootProperty:''
                    }
            }
    });
    
    
    Ext.create('Ext.List', {
       fullscreen: true,
       itemTpl: '<div class="contact">{CompanyCode} <strong>{LastTradedPrice}</strong></div>',
       store: store,
       grouped: true
    });
    Service Url
    Code:
    http://money.rediff.com/money1/current_status_new.php?companylist=17023928|17023929&id=1354690151&Rand=0.6305125835351646
    Json Response
    Code:
    [{"CompanyCode":"17023928","LastTradedPrice":"19,406.69","Volume":"0","PercentageDiff":"-0.06","FiftyTwoWeekHigh":"19,612.18","FiftyTwoWeekLow":"15,358.02","LastTradedTime":"27 Dec,14:52:48","ChangePercent":"-0.06","Change":"-10.77","MarketCap":"0.00","High":"19,504.40","Low":"19,375.52","PrevClose":"19,417.46","OpenInterest":"","MarketLot":"","ChangeInOpenInterest":"","Symbol":null}]

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    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

      1  

    Default


    This is because the response doesn't look like it's returning JsonP, just returning Json.
    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.

  3. #3
    Sencha User
    Join Date
    Jun 2010
    Location
    india
    Posts
    13
    Vote Rating
    0
    arunsathyan is on a distinguished road

      0  

    Default


    Thnaks Mitchell,
    is there any other option to read this and bind to store? i need to access this json from a native app.

Thread Participants: 1

Tags for this Thread