easyui datagrid处理过程

1、解析option

(1)合成column($(target).datagrid("getColumnOption",field);)

$(_4be).children("thead").each(function(){
var opt=$.parser.parseOptions(this,[{frozen:"boolean"}]);
$(this).find("tr").each(function(){
var cols=[];
$(this).find("th").each(function(){
var th=$(this);
var col=$.extend({},$.parser.parseOptions(this,["field","align","halign","order",{sortable:"boolean",checkbox:"boolean",resizable:"boolean",fixed:"boolean"},{rowspan:"number",colspan:"number","number"}]),{title:(th.html()||undefined),hidden:(th.attr("hidden")?true:undefined),formatter:(th.attr("formatter")?eval(th.attr("formatter")):undefined),styler:(th.attr("styler")?eval(th.attr("styler")):undefined),sorter:(th.attr("sorter")?eval(th.attr("sorter")):undefined)});
if(th.attr("editor")){
var s=$.trim(th.attr("editor"));
if(s.substr(0,1)=="{"){
col.editor=eval("("+s+")");
}else{
col.editor=s;
}
}
cols.push(col);
});
opt.frozen?_4c1.push(cols):_4c2.push(cols);
});
});
View Code

2、ajax获取数据

$.ajax({type:opts.method,url:opts.url,data:_218,dataType:"json",success:function(data){
_219(data);
},error:function(){
_21a.apply(this,arguments);
}});
View Code

3、render数据

if(opts.view.onBeforeRender){
opts.view.onBeforeRender.call(opts.view,_51c,data.rows);
}
opts.view.render.call(opts.view,_51c,dc.body2,false);
opts.view.render.call(opts.view,_51c,dc.body1,true);
if(opts.showFooter){
opts.view.renderFooter.call(opts.view,_51c,dc.footer2,false);
opts.view.renderFooter.call(opts.view,_51c,dc.footer1,true);
}
if(opts.view.onAfterRender){
opts.view.onAfterRender.call(opts.view,_51c);
}
View Code


4、

原文地址:https://www.cnblogs.com/chanedi/p/3090314.html