ExtJS setTitle()不更新面板标题

时间:2014-12-19 00:24:36

标签: 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 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本身保持不变

1 个答案:

答案 0 :(得分:1)

查看下面的Jsfiddle Demo以满足您的要求它正在运行。我已经使Grid初始拥有了标题。网格工具栏包含一个按钮“更改标题”,单击以查看所需的解决方案。

this.up('grid').setTitle('New Grid Title');

以下是上面的工作演示:http://jsfiddle.net/PhAbR/83/