数据未通过JSONP Sencha Touch 2加载到列表中

时间:2013-05-15 14:14:28

标签: sencha-touch sencha-touch-2

我一步一步地遵循了Sencha指南,但我似乎没有从我的服务器获得响应。我在控制台中没有出现任何错误,所以我有点难过。任何帮助都会很棒。

以下是我视图中的商店配置

store: {
  fields: ['title', 'description', 'time', 'date', 'image', 'longdesc'],

  proxy: {
     type: 'jsonp',
     url: 'http://mydomain.co.uk/scheduledata.json',
     reader: {
         type: 'json',
         rootProperty: 'scheduleData' 
  }
}

},
itemTpl: '<div class="white-circle">{time}</div> <div class="list-title">{title}</div> <div class="list-desc">{description}</div><div class="arrow-right"></div>'

和我服务器上托管的JSON文件。

{
 "scheduleData" : [
{
  "title" : "Event One",
  "description" : "Meet and Greet",
  "time" : "10:45",
  "date" : "Friday",
  "image" : "./resources/imageone.jpg",
  "longdesc" : "This is a longer description"
},
{
  "title" : "Event Two",
  "description" : "Q and A",
  "time" : "11:00",
  "date" : "Friday",
  "image" : "./resources/imagetwo.jpg",
  "longdesc" : "This is a longer description still"
}
 ]
}

更新:这是包含config的完整JS文件:

Ext.define('scheduleApp.view.Home', {
//extend: 'Ext.Panel',
//xtype: 'homepanel',

extend: 'Ext.navigation.View',
xtype: 'schedulepanel',
id: 'sched',


config: {
    navigationBar: {
            hidden: true
        },
        title: '<span class="logo"></span>',
        items: [
            {
                xtype: 'container',
                layout: 'vbox',
                items: [
                    {
                        xtype: 'container',
                        flex: 2,
                        items: [
                            {
                                xtype: 'container',
                                layout: {
                                    type: 'hbox'
                                },
                                items: [
                                    {
                                    html: '<img src="./resources/map.jpg" width="100%" height="100%"/>'
                                }
                                ]
                            }
                        ]
                    },
                    {
                        xtype: 'container',
                        flex: 5,
                        layout: {
                            type: 'fit'
                        },
                        items: [
                            {
                                xtype: 'list',
                                store: {
                                    type: 'tree',
                                    sorters: 'date',


                                                       fields: ['title', 'description', 'time', 'date', 'image', 'longdesc'],



                                                        proxy: {
                                                            type: 'jsonp',
                                                            url: 'http://www.mydomain.co.uk/scheduledata.json',
                                                            reader: {
                                                                type: 'json',
                                                                rootProperty: 'scheduleData'
                                                            }
                                                        }
                                                    },
                                                    itemTpl: '<div class="white-circle">{time}</div> <div class="list-title">{title}</div> <div class="list-desc">{description}</div><div class="arrow-right"></div>'

                            }
                        ]
                    }
                ]
            }
        ]
    }

});

1 个答案:

答案 0 :(得分:0)

您是否尝试将商店设置为自动加载:是吗?