有关“Ext.applyIf”函数和双管道的参考,请参阅这些文章。
http://docs.sencha.com/core/manual/content/utility.html
http://homepage.ntlworld.com/kayseycarvey/controlflow4.html
有人能解释一下这个逻辑在 ExtJS 框架中做了什么吗?我想确保我的解释在管道的第一行是正确的(尤其是)。
var params = Ext.applyIf(operation.params || {}, this.extraParams || {}), request;
params = Ext.applyIf(params, this.getParams(params, operation));
if (operation.id && !params.id) {
params.id = operation.id;
}
取自 ASP.NET asmx 自定义服务器代理类:
Ext.define('Ext.ux.AspWebAjaxProxy', {
extend: 'Ext.data.proxy.Ajax',
require: 'Ext.data',
buildRequest: function (operation) {
var params = Ext.applyIf(operation.params || {}, this.extraParams || {}), request;
params = Ext.applyIf(params, this.getParams(params, operation));
if (operation.id && !params.id) {
params.id = operation.id;
}
params = Ext.JSON.encode(params);
request = Ext.create('Ext.data.Request', {
params: params,
action: operation.action,
records: operation.records,
operation: operation,
url: operation.url
});
request.url = this.buildUrl(request);
operation.request = request;
return request;
}
});