1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    11
    Vote Rating
    0
    xixichensh is on a distinguished road

      0  

    Post Answered: List Load Form a remote json

    Answered: List Load Form a remote json


    hi,i want request some json data from a rest wcf,then i hope that i can bind these data to a list (sencha touch 2.0 control) but i haven't see any result in the silder panel,what is wrong with the codes.........ask for help...thanks

    my json data
    856.jpg

    sample code
    Code:
    Ext.application({
        name: 'Sencha',
    
    
        launch: function () {
    
    
            Ext.regModel('Tweet', {
                fields: [{
                    name: 'MetricId',
                    type: 'int'
                }, {
                    name: 'HostName',
                    type: 'string'
                }, {
                    name: 'MetricName',
                    type: 'string'
                }]
            });
    
    
            var store = new Ext.data.Store({
                model: 'Tweet',
                proxy: {
                    url: 'http://localhost:8000/Metrics/Metrics',
                    type: 'jsonp',
                    extraParams: {
                        page: 1,
                        pagesize: 10
                    },
                    reader: {
                        root: ''
                    }
                }
            });
    
    
            store.getProxy();
            //.extraParams.q = 'ipad';
            store.read();
    
    
            Ext.create('Ext.Container', {
                fullscreen: true,
                layout: 'hbox',
                items: [
                    {
                        xtype: 'toolbar',
                        docked: 'top',
                        height: 50,
                        scrollable: {
                            direction: 'horizontal',
                            indicators: false
                        },
                        items: [
                            { ui: 'back', text: 'Back' },
                            { text: 'Default' },
                            { ui: 'round', text: 'Round' },
    
    
                            { xtype: 'spacer' },
    
    
                            {
                                xtype: 'segmentedbutton',
                                items: [
                                    { text: 'Option 1' },
                                    { text: 'Option 2', pressed: true },
                                    { text: 'Option 3' }
                                ]
                            },
    
    
                            { xtype: 'spacer' },
    
    
                            { ui: 'action', text: 'Action' },
                            { ui: 'forward', text: 'Forward' },
                            {
                                xtype: 'segmentedbutton',
                                allowMultiple: true,
                                items: [
                                    { text: 'Toggle 1', pressed: true },
                                    { text: 'Toggle 2', pressed: true },
                                    { text: 'Toggle 3' }
                                ]
                            }
                        ]
                    },
                    {
                        xtype: 'list',
                        disclosure: true,
                        onItemDisclosure: {
                            scope: 'test',
                            handler: function (record, btn, index) {
                                store.getProxy();
                                //.extraParams.q = 'ipad';
                                store.read();
                            }
                        },
                        itemSelector: '.tweet',
                        tpl: '<tpl for="."><div class="tweet">{MetricId} - {HostName}</div></tpl>',
                        store: store,
                        flex: 1
                    },
                    {
                        xtype: 'panel',
                        html: 'message preview',
                        flex: 2
                    }
                ]
            });
    
    
            //Ext.Viewport.add(panel);
        }
    });
    Why I can not show the sider panel although the firebug didn't make any error........

  2. Remove the root if you have a blank string in there. Sencha Touch only supports webkit browsers which firefox is not. Chrome has built in dev tools.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,620
    Answers
    3452
    Vote Rating
    817
    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


    Quote Originally Posted by xixichensh View Post
    Why I can not show the sider panel although the firebug didn't make any error........
    Are you using firebug/firefox to use Sencha Touch?
    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.

  4. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    11
    Vote Rating
    0
    xixichensh is on a distinguished road

      0  

    Post yeah,i use the firebug /firefox but also run in the chrome

    yeah,i use the firebug /firefox but also run in the chrome


    Quote Originally Posted by mitchellsimoens View Post
    Are you using firebug/firefox to use Sencha Touch?
    yeah,i use the firebug/firefox to debug but i also run in the chrome,the result is same.
    when i set json without root,there are not any error make ,and when i set the json with root,the return json show "invaild label"

    i have no idea why the rest wcf json can not bind to control,i have spent much time to think this problem.........could you give me some suggestion,thanks

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,620
    Answers
    3452
    Vote Rating
    817
    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


    Remove the root if you have a blank string in there. Sencha Touch only supports webkit browsers which firefox is not. Chrome has built in dev tools.
    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.

  6. #5
    Sencha User
    Join Date
    Nov 2011
    Posts
    11
    Vote Rating
    0
    xixichensh is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    Remove the root if you have a blank string in there. Sencha Touch only supports webkit browsers which firefox is not. Chrome has built in dev tools.
    could you tell me the sencha touch if support wcf rest data source

    i according to the article build my wcf:

    http://michaelarnwine.com/b2evolution/index.php/2010/07/12/wcf-resftul-services-and-extjs


    and now i can not get json data ,the browser always show

    the data invaild label ,i use the jquery getjson method

    try get json data ,the browser show status 200 ok,but

    firebug show red sentence。。。。。now i have no idea

    how to solve the problem。。。。。。。。。help。。。。。。

Thread Participants: 1

Tags for this Thread