是否有允许将DWR远程调用用作YUI数据源的插件或扩展?

时间:2009-02-25 06:50:54

标签: javascript yui dwr

是否有允许将DWR远程调用用作YUI数据源的插件或扩展名?

1 个答案:

答案 0 :(得分:0)

没有插件可以做到这一点。 DwrYuiDataSource目前支持表单

的远程方法
public ReturnType methodName(String query)

但是可以很容易地扩展到beforeArgs和afterArgs以便它 载体

public ReturnType methodName(Object beforeArg1, Object beforeArg2,
    String query, Object afterArg1, Object afterArg2)

javascript:DwrYuiDataSource

mypackage.DwrYuiDataSource = function(remoteMethod) {
    this.remoteMethod = remoteMethod;
    this._init();
};

mypackage.DwrYuiDataSource.prototype = new YAHOO.widget.DataSource();

mypackage.DwrYuiDataSource.prototype.doQuery = function(oCallbackFn,
sQuery, oParent) {
    var oSelf = this;
    this.remoteMethod(sQuery, function(aResults) {
        var resultObj = {};
        resultObj.query = decodeURIComponent(sQuery);
        resultObj.results = aResults;
        oSelf._addCacheElem(resultObj);      
        oSelf.getResultsEvent.fire(oSelf, oParent, sQuery, aResults);
        oCallbackFn(sQuery, aResults, oParent);
    });
};