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