[英]Can't update an extjs gridpanel's toolbar
In extjs 2, I have a function, which returns one of two arrays, which is used on page load for 在extjs 2中,我有一个函数,该函数返回两个数组之一,该数组在页面加载时用于
// onload
var grid = Ext.grid.GridPanel({
...
tbar : getBar()
...
});
...
// later in a function
grid.tbar = getBar()
grid.getView().refresh()
Is there something else I need to refresh? 我还需要刷新吗? Or is there a fundamental difference in setting the tbar at load time--
tbar : getBar()
--versus setting it later-- grid.tbar = getBar()
? 还是在加载时设置tbar有根本区别
tbar : getBar()
以后设置grid.tbar = getBar()
吗?
If you want get your grid's toolbar you're better using 如果要获取网格的工具栏,最好使用
grid.getTopToolbar();
and then to refresh the layout of the toolbar you need to use 然后刷新工具栏的布局,您需要使用
grid.getTopToolbar().doLayout();
The doLayout();
doLayout();
will tell ExtJS to redraw the toolbar's layout with any changes that you have made to it. 会告诉ExtJS重新绘制工具栏的布局以及对其所做的任何更改。
Hope this helps 希望这可以帮助
Since doLayout
isn't available in 2.2, I was recommended to just add all possible buttons/widgets to the toolbar and show/hide them individually. 由于
doLayout
在2.2中不可用,因此建议我仅将所有可能的按钮/小部件添加到工具栏中,然后分别显示/隐藏它们。 This seems to work suitably. 这似乎工作正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.