我承認,這不是一個理想的解決方案,而這個問題是有點老了,但是這個代碼已經工作得相當好,我在這個場地:
Ext.override(Ext.tree.TreeLoader, {
requestData : function(node, callback, scope) {
var originalDataUrl = this.dataUrl;
this.dataUrl += "/" + this.getParams(node).node;
if(this.fireEvent("beforeload", this, node, callback) !== false){
if(this.directFn){
var args = this.getParams(node);
args.push(this.processDirectResponse.createDelegate(this, [{callback: callback, node: node, scope: scope}], true));
this.directFn.apply(window, args);
}else{
this.transId = Ext.Ajax.request({
method:this.requestMethod,
url: this.dataUrl||this.url,
success: this.handleResponse,
failure: this.handleFailure,
scope: this,
argument: {callback: callback, node: node, scope: scope}
//params: this.getParams(node)
});
}
}else{
// if the load is cancelled, make sure we notify
// the node that we are done
this.runCallback(callback, scope || node, []);
}
this.dataUrl = originalDataUrl;
}
});
真的,唯一的大缺點是當你走下這條路時,完全沒有參數。就我而言,我只需要節點ID。但是如果你想覆蓋你的加載方法,這應該至少給你一個很好的起點! :)
我以爲很多,謝謝。 – 2010-09-24 08:46:24