0
我有一个面板,如下所示:的ExtJS的setTitle()不更新面板标题
Ext.define('TestPanel', {
extend: 'Ext.panel.Panel',
alias: 'widget.testPanel',
id: 'testerPanel',
title: 'oldTilte',
//other code
});
我有不同视图的控制器,其中我希望更新的面板标题:
var grid = Ext.getCmp('testerPanel');
grid.setTitle('newTitle'); //doesn't update the title
//tried with including ref or view in the controller
this.getTestPanel().setTitle('newTitle'); //this didn't update it either
如何更新面板标题?此外,对于上述尝试,如果我打印console.info(grid)
或console.info(this.getTestPanel())
,我总是看到在控制台输出更新的标题,但UI本身保持不变
肯定有网格的其他实例?您使用getCmp来获取网格的实例,并且总是有风险的,因为您必须确保这些ID是唯一的。改用ComponentQuery。 – Saki 2014-12-19 09:02:15