1. #1
    Sencha User
    Join Date
    May 2012
    Location
    Bangalore
    Posts
    74
    Vote Rating
    0
    Rameshlamani is on a distinguished road

      0  

    Default how to Parse JSON object and bind to dataview

    how to Parse JSON object and bind to dataview


    Hi i am not able to bind PromoUrl value to itemTpl, i have this value in JSON. how to do this one. please any one can help me. how to fix this problem

    Here is my code:
    Code:
    Ext.define("GS.view.Twitter", {
        extend: 'Ext.navigation.View',
        xtype: 'twitter',
        requires: [
            'Ext.data.JsonP'
        ],
        config: {
            title: 'Blog',
            iconCls: 'star',
            items: {
                xtype: 'dataview',
                itemTpl: '{PromoUrl}',
                title: 'Recent Posts',
                store: {
                    autoLoad: true,
                    fields: ['PromoUrl'],
                    proxy: {
                        type: 'jsonp', 
                        url: 'MyUrlpathlink', 
                        reader: {
                            type: 'json',
                            rootProperty: 'd'
                        }
                    }
                }
            }
        }
    });
    Here is my Json:

    Code:
    { "d" : { "CompanyId" : 1,
          "ExceptionId" : 0,
          "PromoUrl" : "videos/Wildlife.mp4",
          "__type" : "Company:#ABC"
        } }

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,656
    Vote Rating
    435
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    d should be an array. You are using JSONP so is the JSON wrapped in a callback method that makes it JSONP?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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

  3. #3
    Sencha User
    Join Date
    May 2012
    Location
    Bangalore
    Posts
    74
    Vote Rating
    0
    Rameshlamani is on a distinguished road

      0  

    Default


    k..Thank you

Tags for this Thread