【问题标题】:Data fro Store to combobox, undefind从源到组合框的数据,未定义
【发布时间】:2014-06-15 03:06:31
【问题描述】:

您好,我是从服务器日期获取存储的 "url: /author/name" 。而这个响应来自服务器

{
status: "SUCCESS",
msg: "операция завершена успешно",
data: [
{
aname: "Pushkin"
},
{
aname: "Lermontov"
}
]
}

这是商店:

Ext.define('TPL.store.Author', {
        fields: [
        {name: 'aname', value: 1},

    ],
    proxy: {
    type: 'ajax',
    url: '/author/name"',
    reader: {
            type: 'json',
            root: 'data',
            successProperty: 'success'
    }
}
});

这是组合:

     {
                    xtype: 'combobox',
                    store: 'Author',
                    queryMode: 'local',
                    displayField: 'aname',
                    valueField: 'aname',
                    width: 600,
                    name: 'aname',
                },

但是当我使用组合打开表单时,我在控制台“null”中。我想从存储中插入组合数据:("Pushkin" "Lermontov")

【问题讨论】:

标签: json extjs combobox store


【解决方案1】:

您只定义了商店,没有创建实例。此外,您必须告诉商店加载他的数据。

做这样的事情:

var authorStore = Ext.create('TPL.store.Author', {
    successProperty: 'status',
    autoLoad: true
});
//Configuration in combobox:
{
  store: authorStore,
}

【讨论】:

  • 我在控制台中有这个:Uncaught TypeError: Cannot read property 'on' of undefined
  • 你知道哪个文件和方法会抛出这个错误吗?我认为这与我的回答无关。
猜你喜欢
  • 2013-09-03
  • 2013-09-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-07-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多