由于在网上没有找到Coolite.AjaxMethod.request的详细资料和API,特记录如下:
直接调用时cleanRequest : true必不可少
//Source Project/Coolite.Ext.Web/Core/AjaxMethod.cs之public class AjaxMethodAttribute : Attribute
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class AjaxMethodAttribute : Attribute
{
private string failureFn;
private HttpMethod method = HttpMethod.POST;
private ClientProxy proxyCreation;
private string successFn;
private AjaxEventType type = AjaxEventType.Submit;
private string msg;
private string msgCls;
private MaskTarget target = MaskTarget.Page;
private string customTarget;
private bool showMask;
private ViewStateMode viewStateMode = ViewStateMode.Default;
private string ajaxMethodNamespace;
private int timeout = 30000;
//Source Project/Coolite.Ext.Web/Events/AjaxEvents/BaseAjaxEvent.cs之public class EventMask : LoadMask
// @source core/form/AjaxMethod.js
var obj = {
name : options.cleanRequest ? undefined : (options.name || name),
cleanRequest : options.cleanRequest,
url : options.url,
control : Ext.isEmpty(options.control) ? null : { id : options.control },
eventType : options.specifier || "public",
type : options.type || "submit",
method : options.method || "POST",
eventMask : options.eventMask,
extraParams : options.params,
ajaxMethodSuccess : options.success,
ajaxMethodFailure : options.failure,
viewStateMode : options.viewStateMode,
userSuccess : function (response, result, control, eventType, action, extraParams, o) {
if (!Ext.isEmpty(o.ajaxMethodSuccess)) {
result = Ext.isEmpty(result.result, true) ? (result.d || result) : result.result;
o.ajaxMethodSuccess(result, response, extraParams, o);
}
},
userFailure : function (response, result, control, eventType, action, extraParams, o) {
if (!Ext.isEmpty(o.ajaxMethodFailure)) {
o.ajaxMethodFailure(result.errorMessage, response, extraParams, o);
}
}
};
public enum MaskTarget
{
This,
Parent,
Page,
CustomTarget
}
private MaskTarget target = MaskTarget.Page;
private string customTarget;
从上面可以看到MaskTarget与customTarget的区别
完整文章等源码第二部分提交后再详细写。