* 异步返回数据
*/
var loadActivitys = function () {
var layerIndex = blockScreen(20000, function () {
});
var handleAjaxData = function (ajaxData) {
var res_code = ajaxData.res_code;
var res_info = ajaxData.res_info;
if (typeof res_code == "undefined") {
alertError("请求错误!");
return;
}
if (res_code == -1) {
alertError(res_info);
return;
}
var tableDataArray = [];
if (res_code == 0) {
$.each(ajaxData.res_data, function (i, obj) {
var objEle=[];
tableDataArray.push(objEle);
});
$("#table").dataTable({
"language": {
"url": "/static/datatable/Chinese.txt"
},
"data": tableDataArray,
"columns": [
{"title": "列1", "class": "center needCut", "width": "15%"},
{"title": "列2", "class": "center","width": "13%"},
{"title": "列3", "class": "center needCut","width": "10%"},
{"title": "列4", "class": "center needCut","width": "20%"}
],
"initComplete": function () {
doAfter();
},
"autoWidth": false,
"destroy": true,
"pagingType": "full_numbers",
"pageLength": 25,
"searching": false,
"paging": false,
"info": false
});
var pageArgs=ajaxData.PAGE_ARGS;
var pageCount=pageArgs.pageCount;
var currentPage=pageArgs.currentPage;
var pageRange=pageCount<20?pageCount:20;
lpage($("#pager"),pageCount,pageRange,currentPage,function(curr,first){
if(first){
return;
}
});
}
unBlockScreen(layerIndex);
};
ajaxCallback("xxxaction", $("#form").serialize(), "获取数据失败", handleAjaxData);
};