object
Since 1.10.1: An object that contains additional information about the cell being requested. This object contains the following properties:
row – The row index for the requested cell. See row().index().
col – The column index for the requested cell. See column().index().
settings – The DataTables.Settings object for the table in question. This can be used to obtain an API instance if required.
对ajax和columns都设置好以后,就可以将整个选项对象绑定到DT中了
$(“table.operation-table”).DataTable(operationTableOption);
四、服务端支持
@ResponseBody
@RequestMapping(method = RequestMethod.POST,value = "query")
public BaseResult queryOperation(OperationQueryParam param)
{
if(param == null)
return null;
BaseResult result = new BaseResult();
CommonDatatableBean tableBean = new CommonDatatableBean();
tableBean.setDraw(param.getDraw());
int totalAmount = mOperationService.getOperationCount();
tableBean.setRecordsTotal(totalAmount);
tableBean.setRecordsFiltered(totalAmount);
int limit = param.getStart();
List<Object> list = new ArrayList<Object>();
String sortType = param.getSortType() == 0?"ASC":"DESC";
List<Operation> operations = mOperationService.queryOperationPaged(limit,param.getOffset(),param.getSortPro(),sortType);
if(operations != null && operations.size() > 0)
{
for(Operation operation:operations)
{
list.add(operation);
}
}
tableBean.setData(list);
result.setData(tableBean);
result.setResult(ResultCode.SUCCESS);
return result;
}好了这篇文章就介绍到这了,更多内容可以查看软件开发网以前发布的文章。










