访问网格面板 Extjs 中的存储
这可能是一个愚蠢的问题,但我无法弄清楚如何访问 gridpanel 中的 store
var grid = new Ext.grid.GridPanel({
.....
store: store,
......
listeners: {
'beforerender' : function(grid) {
//grid.getStore();
}
}
我想循环访问 store ,但 grid.getStore() 返回空对象。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以简单地执行
grid.store
。如果您知道它会在网格渲染之前填充数据(您似乎是从网格
beforerender
事件中调用它),您可以执行grid.store.getRange()
正如您在问题中提到的那样,获取您想要循环的记录。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 dogrid.store.getRange()
to get the records that you want to loop through, as you mentioned in your question.store 变量在您的侦听器代码中仍然可见:)
store variable is still visible in your listener code :)