访问 Extjs4 中的标头容器
我想调用标头容器的 getGridColumns()
方法,但我无法访问网格的标头容器。我尝试了以下方法:
initComponent : function() {
var grid = this;
var headerCt = grid.getView.getHeaderCt(); //here
var menuItems = new Array();
menuItems = headerCt.getGridColumns(true);
...
}
但这不起作用。它给我错误“对象不支持此属性或方法”。有什么建议吗?
I want to call the getGridColumns()
method of the header container but I am not getting access to the grid's header container. I tried the following:
initComponent : function() {
var grid = this;
var headerCt = grid.getView.getHeaderCt(); //here
var menuItems = new Array();
menuItems = headerCt.getGridColumns(true);
...
}
but this is not working. It gives me error as 'Object doesn't support this property or method'. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过在定义网格列时设置侦听器(通过传入对象而不是仅传入数组),我已经能够满足访问网格标头容器的大部分需求。然后,在 columns 对象的项目中设置列数组。
示例:
获得
headerCt
后,您就可以调用getGridColumns()
或getVisibleGridColumns()
。希望这有帮助。
I've been able to satisfy most of my needs to access a grids header container by setting listeners when defining the columns of the grid (by passing in an object instead of just an array). Then, set your array of columns in the items of the columns object.
Example:
Once you have the
headerCt
then you can callgetGridColumns()
orgetVisibleGridColumns()
.Hope this helps.