0

Extパネルがあり、いくつかの変数からパネルのタイトルを設定したいと思います。

パネルのを持っているので、idそこからパネルのタイトルを設定する必要があります。

私はこのようなものを探しています、

Ext.getCmp('myPanel').setTitle();アトリビュートのように

Ext.define('Myapplication.view.Contacts', {
    extend: 'Ext.Panel',
    alias: 'widget.Contacts',
    id: 'myPanelID',
    ----
    -----
    ------
    -----

    listeners: [
        {
           fn: 'initComponent',
           event: 'initialize'
        }
    ]
},
initComponent: function(component, options, wstitle) {
    Ext.getCmp('myPanelID').header.title = ('Title of panel'); //Not working
    Ext.getCmp('myPanelID').setTitle= ('Title of panel'); //Not working
}

常にエラーが発生しました:

TypeError:'undefined'はオブジェクトではありません('Ext.getCmp(' myPanel')。setTitle'を評価しています)

4

3 に答える 3

1

Ext.Panelはその代わりにExt.Container、はコンテナであり、オブジェクトではありません。titleあなたがこのような何かを試すことができるような誰かを変えたいなら、

Ext.define('Myapplication.view.Contacts', {
    extend: 'Ext.Panel',
    alias: 'widget.Contacts',
    id: 'myPanelID',
    ...

    html: '<div>Your Title</div>',
    ...

    initComponent: function(component, options, wstitle) {
        Ext.getCmp('myPanelID').setHtml('<div>Another Title</div>');
    }
})

これらがお役に立てば幸いです。:)

于 2012-08-11T05:34:08.307 に答える
0

Ext.getCmp('myPanelID').setTitle関数です。

それで...

Ext.getCmp('myPanelID').setTitle('Title of panel');

あなたが探しているものです

于 2012-08-10T06:38:00.400 に答える
0

構文エラーが発生しました。あなたが書く

Ext.getCmp('myPanelID').setTitle= ('Title of panel'); //Not working

=文字を削除します

Ext.getCmp('myPanelID').setTitle('Title of panel'); //Works like a charm

乾杯、オレグ

于 2012-08-10T10:38:33.353 に答える