简体   繁体   English

在网格面板Extjs中访问存储

[英]Access store in grid panel Extjs

This could be a stupid question, but I cant figure out how to access store in gridpanel 这可能是一个愚蠢的问题,但我无法弄清楚如何访问gridpanel中的商店

  var grid = new Ext.grid.GridPanel({
    .....
    store: store,
    ......
      listeners: {
        'beforerender' : function(grid) {
          //grid.getStore();
            }
           }

I want to loop through the store , but grid.getStore() returns empty object. 我想遍历store,但是grid.getStore()返回空对象。

you can simply do grid.store . 您可以简单地进行grid.store

If you know it will be filled with data before the grid renders (you seem to be calling this from the grid beforerender event) you can do grid.store.getRange() to get the records that you want to loop through, as you mentioned in your question. 如果你知道网格渲染之前,将填充数据(你似乎是从电网调用这个beforerender事件),你可以做grid.store.getRange()以获得您想要通过循环记录,正如你所提到在你的问题。

在您的侦听器代码中, store变量仍然可见:)

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

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