简体   繁体   中英

Access store in grid panel Extjs

This could be a stupid question, but I cant figure out how to access store in 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.

you can simply do 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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