Model view controller ExtJS setTitle()不';t更新面板标题

Model view controller ExtJS setTitle()不';t更新面板标题,model-view-controller,panel,title,extjs4.2,Model View Controller,Panel,Title,Extjs4.2,我有一个小组如下: 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 u

我有一个小组如下:

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(网格)
console.info(this.getTestPanel())
,我总是在控制台输出中看到更新的标题,但UI本身保持不变,请查看下面的JSFIDLE演示,了解您的需求。我已经制作了带有初始标题的网格。网格工具栏包含一个按钮“更改标题””单击以查看所需的解决方案

this.up('grid').setTitle('newgrid Title')


这是上面的工作演示:

确定没有其他网格实例吗?使用getCmp获取网格实例总是有风险的,因为必须确保ID是唯一的。改用ComponentQuery。