繁体   English   中英

从另一个文件访问Ext Designer JsonStore

[英]Accessing Ext Designer JsonStore from another file

我想从另一个面板用户js文件访问从ext设计器创建的JsonStore。 从设计器生成的文件存储文件如下所示

myJsonStore = Ext.extend(Ext.data.JsonStore, {
 constructor: function(cfg) {
    cfg = cfg || {};
    CoaJsonStore.superclass.constructor.call(this, Ext.apply({
        storeId: 'myJsonStore',
        url: '/server.json',
        restful: true,
        autoLoad: true,
        autoSave: false,
        fields: [
            {
                name: 'id'
            },
            {
                name: 'code'
            },
            {
                name: 'name'
            }

        ]
    }, cfg));
}
});
new myJsonStore();

我现在正在执行的操作是使用隐藏的组合,并将存储分配给组合,这使我可以通过autoRef(使用combo.getStore(),它为我提供对象类型)来访问它。 理想情况下,我希望能够在没有隐藏组合的情况下进行操作。

我试图用storeId引用它,但是它不起作用,如果我将storeId登录到控制台,这就是我得到的。

 function (cfg) {
    cfg = cfg || {};
    CoaJsonStore.superclass.constructor.call(this, Ext.apply({
        storeId: 'myJsonStore',
        url: '/coas.json',
        restful: true,
........

所以我只是想知道这是否有可能。 如果是这样,将会非常感激如何完成它的方向。 谢谢

new myJsonStore(); 仅创建一个新商店。 为了在代码的其他位置(同一文件或另一个文件)引用存储,您需要使用一个变量。 像这样创建商店:

 var myStore = new myJsonStore();

要将其绑定到comobobox,请使用带有store属性的变量名称myStore

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM