加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

extjs4.1 – ExtJS 4.1.1a:JsonStore proxy url =“无法调用方

发布时间:2020-12-16 18:40:51 所属栏目:百科 来源:网络整理
导读:此代码块有效: Ext.define('MyApp.store.MyJsonStore',{ extend: 'Ext.data.Store',fields: ['fieldName'],proxy: { type: 'ajax',url: 'json.php',reader: 'json' }}); 这一次崩溃: Ext.define('MyApp.store.MyJsonStore',{ extend: 'Ext.data.JsonStore'
此代码块有效:

Ext.define('MyApp.store.MyJsonStore',{
    extend: 'Ext.data.Store',fields: ['fieldName'],proxy: {
        type: 'ajax',url: 'json.php',reader: 'json'
    }
});

这一次崩溃:

Ext.define('MyApp.store.MyJsonStore',{
    extend: 'Ext.data.JsonStore',reader: 'json'
    }
});

这是出现问题的地方:

难道我做错了什么?

解决方法

JsonStore在ExtJs库中有点像红色区域……

如果你看一下JsonStore的来源,你会看到:

constructor: function(config) {
    config = Ext.apply({
        proxy: {
            type  : 'ajax',reader: 'json',writer: 'json'
        }
    },config);
    this.callParent([config]);
}

实际上,商店会覆盖您自己的配置.

老实说,我很难想到你为什么更喜欢JsonStore而不是Ext.data.Store.从设计的角度来看,Json更像是一个读者 – 商店只是存储记录.

我只在我的应用程序中使用Ext.data.Store和Ext.data.TreeStore.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读