Grid Extjs 4:网格在web界面中复制了相同的结构。每个网格都有不同的存储

Grid Extjs 4:网格在web界面中复制了相同的结构。每个网格都有不同的存储,grid,structure,store,extjs4.2,Grid,Structure,Store,Extjs4.2,我有一个带有多个网格的web界面 每个网格具有相同的结构。 但每个网格都由同一型号的不同存储区填充 Ext.define("erapnot.view.taskslist.EastItemSdPnGrid", { extend: "Ext.grid.Panel", xtype: "eastitemsdpngrid", store: "EastItemStore", columns:[... 我尝试为每个网格添加一个“id”,如下所示: id:'east-panel', xty

我有一个带有多个网格的web界面 每个网格具有相同的结构。 但每个网格都由同一型号的不同存储区填充

Ext.define("erapnot.view.taskslist.EastItemSdPnGrid", {
  extend: "Ext.grid.Panel",
  xtype: "eastitemsdpngrid",
  store: "EastItemStore",
  columns:[...
我尝试为每个网格添加一个“id”,如下所示:

id:'east-panel',  
xtype: 'panel',
region:'east',
title: 'LIST',
items: [{ 
          id:'**firsteastitemgrid**',
          xtype: "eastitemgrid" 
       }, { 
          id:'**secondeastitemgrid**',
          xtype: "eastitemgrid" 
       }
       ]
},
所以我在我的网格中尝试了这个

Ext.define("erapnot.view.taskslist.EastItemGrid", {
  extend: "Ext.grid.Panel",
  xtype: "eastitemgrid",
  store:{"#firsteastitemgrid": "EastItemStore" , 
         "#secondeastitemgrid":"EastItemDifStore"},
我没有语法错误,但它不工作

是否可以使用多个存储区定义一次网格?或者,即使所有网格都具有相同的结构、模型和控制器,我也必须逐个存储创建一个网格


提前谢谢

你的解决方案似乎很奇怪。尝试在实例化期间设置存储:

items: [{ 
      store:"EastItemStore",
      xtype: "eastitemgrid" 
   }, { 
      store:"EastItemDifStore",
      xtype: "eastitemgrid" 
   }]

在网格定义中,不要设置任何存储。

您的解决方案似乎很奇怪。尝试在实例化期间设置存储:

items: [{ 
      store:"EastItemStore",
      xtype: "eastitemgrid" 
   }, { 
      store:"EastItemDifStore",
      xtype: "eastitemgrid" 
   }]

在网格定义中,不要设置任何存储。

您的解决方案似乎很奇怪。尝试在实例化期间设置存储:

items: [{ 
      store:"EastItemStore",
      xtype: "eastitemgrid" 
   }, { 
      store:"EastItemDifStore",
      xtype: "eastitemgrid" 
   }]

在网格定义中,不要设置任何存储。

您的解决方案似乎很奇怪。尝试在实例化期间设置存储:

items: [{ 
      store:"EastItemStore",
      xtype: "eastitemgrid" 
   }, { 
      store:"EastItemDifStore",
      xtype: "eastitemgrid" 
   }]

在网格定义中,不要设置任何存储。

执行以下操作:

Ext.define('MyGrid', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.mygrid',

    columns: [],

    initComponent: function() {
        this.store = new Ext.data.Store({
            model: 'MyModel',
            proxy: {
                type: 'ajax',
                url: this.storeUrl
                // other options here
            }
        });
        this.callParent();
    }
});
然后您可以稍后使用它:

items: [{
    xtype: 'mygrid',
    storeUrl: '/foo/a'
}, {
    xtype: 'mygrid',
    storeUrl: '/foo/b'
}, {
    xtype: 'mygrid',
    storeUrl: '/foo/c'
}]

这样做:

Ext.define('MyGrid', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.mygrid',

    columns: [],

    initComponent: function() {
        this.store = new Ext.data.Store({
            model: 'MyModel',
            proxy: {
                type: 'ajax',
                url: this.storeUrl
                // other options here
            }
        });
        this.callParent();
    }
});
然后您可以稍后使用它:

items: [{
    xtype: 'mygrid',
    storeUrl: '/foo/a'
}, {
    xtype: 'mygrid',
    storeUrl: '/foo/b'
}, {
    xtype: 'mygrid',
    storeUrl: '/foo/c'
}]

这样做:

Ext.define('MyGrid', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.mygrid',

    columns: [],

    initComponent: function() {
        this.store = new Ext.data.Store({
            model: 'MyModel',
            proxy: {
                type: 'ajax',
                url: this.storeUrl
                // other options here
            }
        });
        this.callParent();
    }
});
然后您可以稍后使用它:

items: [{
    xtype: 'mygrid',
    storeUrl: '/foo/a'
}, {
    xtype: 'mygrid',
    storeUrl: '/foo/b'
}, {
    xtype: 'mygrid',
    storeUrl: '/foo/c'
}]

这样做:

Ext.define('MyGrid', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.mygrid',

    columns: [],

    initComponent: function() {
        this.store = new Ext.data.Store({
            model: 'MyModel',
            proxy: {
                type: 'ajax',
                url: this.storeUrl
                // other options here
            }
        });
        this.callParent();
    }
});
然后您可以稍后使用它:

items: [{
    xtype: 'mygrid',
    storeUrl: '/foo/a'
}, {
    xtype: 'mygrid',
    storeUrl: '/foo/b'
}, {
    xtype: 'mygrid',
    storeUrl: '/foo/c'
}]

他们有什么不同?当然,您并不是一次又一次地用相同的内容显示完全相同的网格。例如,所有网格的内容都是“name”“firstname”。只有后端中的SQL请求检索不同的结果,但所有网格将显示一个包含“name”“firstname”列表的结果。对,但它如何检索不同的结果?我的观点是,改变的部分是什么。服务器不会随机返回不同的数据。除了my store.js文件中的“proxy:{url:'abc/cde'…..”调用不同的SQL请求之外,没有任何更改。它们有什么不同?当然,您不会一次又一次地用相同的内容显示完全相同的网格。例如,所有网格内容“name”“firstname”“。只有后端的SQL请求检索不同的结果,但所有网格将显示一个包含“name”“firstname”列表的结果。对,但它如何检索不同的结果?我的问题是,更改的部分是什么。服务器不会随机返回不同的数据。除了我的“proxy:{url:'abc/cde'..在my store.js文件中调用不同的SQL请求。它们有什么不同?当然,您并不是一次又一次地用相同的内容显示完全相同的网格。例如,所有网格内容“name”“firstname”“。只有后端的SQL请求检索不同的结果,但所有网格将显示一个包含“name”“firstname”列表的结果。对,但它如何检索不同的结果?我的问题是,更改的部分是什么。服务器不会随机返回不同的数据。除了我的“proxy:{url:'abc/cde'..在my store.js文件中调用不同的SQL请求。它们有什么不同?当然,您并不是一次又一次地用相同的内容显示完全相同的网格。例如,所有网格内容“name”“firstname”“。只有后端的SQL请求检索不同的结果,但所有网格将显示一个包含“name”“firstname”列表的结果。对,但它如何检索不同的结果?我的问题是,更改的部分是什么。服务器不会随机返回不同的数据。除了我的“proxy:{url:'abc/cde'..在my store.js文件中调用不同的SQL请求。