"sAjaxSource" : "<%=PATH%>/listt?&now=" + new Date().getTime(), //服务器端,数据回调处理 "fnServerData" : function(sSource, aDataSet, fnCallback, oSettings) { oSettings.jqXHR = $.ajax({ "dataType" : ‘json‘, "type" : "POST", "url" : sSource, "data" : aDataSet, "success" : fnCallback }); }
"fnDrawCallback" : function(oSettings){
//取出服务器返回的自定义参数
var aaMap = JSON.parse(oSettings.jqXHR.responseText).aaMap;
var totalInsurMoney = aaMap.totalInsurMoney;
var totalMoney = aaMap.totalMoney;
}
返回实体增加aaMap:
package cn.shibei.dto; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * * @author huangfeihong * */ public class DataTablesGrid implements java.io.Serializable { /** * */ private static final long serialVersionUID = -7580029322263269040L; private long iTotalRecords;// 过滤前总记录数 private long iTotalDisplayRecords;// 过滤后总记录数,未开启过滤,不使用 private String sSearch;// 页面发来的参数,原样返回 private List aaData = new ArrayList();// 包含数据的list private Map<Object, Object> aaMap = new HashMap<Object, Object>();//自定义返回参数及数据 public DataTablesGrid() { } public DataTablesGrid(long iTotalRecords, long iTotalDisplayRecords, String sSearch, List aaData) { super(); this.iTotalRecords = iTotalRecords; this.iTotalDisplayRecords = iTotalDisplayRecords; this.sSearch = sSearch; this.aaData = aaData; } public long getiTotalRecords() { return iTotalRecords; } public void setiTotalRecords(long iTotalRecords) { this.iTotalRecords = iTotalRecords; } public long getiTotalDisplayRecords() { return iTotalDisplayRecords; } public void setiTotalDisplayRecords(long iTotalDisplayRecords) { this.iTotalDisplayRecords = iTotalDisplayRecords; } public String getsSearch() { return sSearch; } public void setsSearch(String sSearch) { this.sSearch = sSearch; } public List getAaData() { return aaData; } public void setAaData(List aaData) { this.aaData = aaData; } public static long getSerialversionuid() { return serialVersionUID; } public Map<Object, Object> getAaMap() { return aaMap; } public void setAaMap(Map<Object, Object> aaMap) { this.aaMap = aaMap; } }
时间: 2024-12-28 22:34:48