我有一個部件的作用就像一個錶行,稱爲flightLegComponent像這樣:EXT-JS除去組分的疑難雜症
[ flight leg component ] [-] [+]
[ flight leg component] [-] [+]
...
當[ - ]鍵被按下時,該組分是意味着從父面板中刪除。
我已經加入一個監聽到[ - ]按鈕,然後在該偵聽器,我調用
this.remove(theFlightLegComponent);
其中「這」是父組件。
這引發了一個異常,顯然,你不能刪除事件處理程序中的組件......什麼是刪除它的正確方法?在延遲後調用方法?
新:
的面板構造成:
_flightLegRow: function(removable) {
var flightLegInput = new xx.yy.zz.search.FlightLegInput({
columnWidth: .8
});
var legId = 'flightLeg-' + this.legs++;
var c = {
border: 0,
width: '90%',
layout: 'column',
id: legId,
items: [
flightLegInput,
{
columnWidth: .2,
margin: 10,
border: 0,
layout: {
type: 'column'
},
items: [{
xtype: 'button',
text: '-',
disabled: !removable,
listeners: {
click: Ext.Function.bind(function() {
//debugger;
this.remove(legId, true);
}, this)
}
},{
xtype: 'button',
text: '+',
listeners: {
click: Ext.Function.bind(function(){
this.add(this._flightLegRow(true));
}, this)
}
}]
}
]
};
return c;
}
我使用** EXT-JS 4 ** – Dzhu 2011-05-24 02:28:20
我已經發布了同樣的問題在ExtJS的論壇,它是一個星期也沒有答案了!對於任何決定DOJO和ExtJS的人,請選擇DOJO!雖然ExtJS可能表面上看起來很漂亮,但當您深入研究代碼並想要做更復雜的事情時,您將不得不編寫一些您可能會寫的最複雜的代碼。 ExtJS絕對是我碰過的最尷尬的框架之一。我已經使用道場一段時間,並可以真正地說,道場在前方。 – Dzhu 2011-05-31 22:56:32