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.
我想遍历商店,但grid.getStore()返回空对象。
2 个解决方案
#1
1
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.
如果你知道它将在网格渲染之前填充数据(你似乎是从网格前调用事件中调用它)你可以做grid.store.getRange()来获取你想要循环的记录,如你所提到的在你的问题。
#2
0
store variable is still visible in your listener code :)
存储变量仍然在您的侦听器代码中可见:)
#1
1
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.
如果你知道它将在网格渲染之前填充数据(你似乎是从网格前调用事件中调用它)你可以做grid.store.getRange()来获取你想要循环的记录,如你所提到的在你的问题。
#2
0
store variable is still visible in your listener code :)
存储变量仍然在您的侦听器代码中可见:)