如何訪問I 「將myHandler」 從「標題 - > tbar->用品 - >處理程序中:JS範圍問題
Application.MenuPanel = Ext.extend(Ext.Panel, {
title: 'Standard',
tbar: [{
xtype: 'buttongroup',
columns: 3,
title: 'MyTitle',
items: [{
text: 'Addl',
scale: 'large',
rowspan: 3, iconCls: 'add',
iconAlign: 'top',
cls: 'x-btn-as-arrow',
handler: this.myHandler.createDelegate(this, ['Hello World']) // <-- How to acces myHandler()?
},
{
text: 'Delete',
scale: 'large',
rowspan: 3, iconCls: 'delete',
iconAlign: 'top',
cls: 'x-btn-as-arrow'
},
]
}]
,myHandler : function (name) {
Ext.Msg.alert('Inside', 'Hello ' + name);
}
});
錯誤:
this.myHandler is undefined [Break on this error] handler: this.myHandler.createDelegate(this, ['Hello World'])
謝謝。下面的工作示例。 – fabian 2011-02-08 11:12:50