Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Extjs dockedItems-来自面板的文本_Extjs_Extjs4_Extjs4.1_Extjs4.2 - Fatal编程技术网

Extjs dockedItems-来自面板的文本

Extjs dockedItems-来自面板的文本,extjs,extjs4,extjs4.1,extjs4.2,Extjs,Extjs4,Extjs4.1,Extjs4.2,我有一个树面板 一切正常 Ext.define('My.Tree', { extend:'Ext.tree.Panel', id: 'DriveTree', store: storeTree, ChooseButtonText: 'ChooseFolder', dockedItems: [{ xtype: 'toolbar', items: [{ text: 'BUTTON TEXT', //

我有一个树面板

一切正常

Ext.define('My.Tree', {
    extend:'Ext.tree.Panel',
    id: 'DriveTree',
    store: storeTree,


    ChooseButtonText: 'ChooseFolder',
    dockedItems: [{
        xtype: 'toolbar',
         items: [{
           text: 'BUTTON TEXT', //  this.ChooseButtonText
           id:'connectButton',

                   handler: function(){

                              alert(this.ChooseButtonText);

                         }
         }, 

         ]
    }],


});



Ext.onReady(function(){
var tree =Ext.create('My.Tree', {});
});
但dockedItems的文本希望来自面板。大概是这样的:

text:this.ChooseButtonText

每个DockedItem都有侦听器处理程序:function(){}。我怎样才能看到这个函数中的变量呢?

在initComponent中执行此操作:

Ext.define('My.Tree', {
    extend: 'Ext.tree.Panel',
    id: 'DriveTree',
    store: storeTree,

    ChooseButtonText: 'ChooseFolder',
    initComponent: function() {
        this.dockedItems = [{
            xtype: 'toolbar',
            items: [{
                text: this.ChooseButtonText,
                scope: this,
                handler: this.onConnectButtonClick
            }]
        }];
        this.callParent();
    },

    onConnectButtonClick: function() {
        console.log('Do something');
    }
});

未捕获的TypeError:Object[Object Array]没有方法“insert”,每个DockedItem都有侦听器-处理程序:function(){}。我怎样才能看到这个函数中的变量呢?