Jquery Datatables的使用详解(6)

The data for the cell (based on columns.data)

 
2   type  

string

  No  
 

The type call data requested. This is used for DataTables' orthogonal data support. This value will be one of:

See also the cell().render() method which can be used to execute the given rendering method at any arbitrary time.

 
3   row  

Any

  No  
 

The full data source for the row (not based on columns.data)

 
4   meta  

object

  No  
 

Since 1.10.1: An object that contains additional information about the cell being requested. This object contains the following properties:

 

对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; }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/30a436e759601c1ed20785702e2513c0.html