创建常用的参数集合dataTablesSettings.js
$.dataTablesSettings = {
"ajax": "",
"destroy" : true, //销毁表格对象
"bDestroy" : true, //销毁表格对象
"aLengthMenu":[5,10,20,50,100], //用户可自选每页展示数量 5条或10条
"searching":false,//禁用搜索(搜索框)
"lengthChange":true,
"paging": true,//开启表格分页
"bProcessing" : true,
"bServerSide" : true,
"bAutoWidth" : false,
"bRetrieve": true,
// "sort" : "position",
"deferRender":true,//延迟渲染
// "bStateSave" : false, //在第三页刷新页面,会自动到第一页
// "retrieve" : true, //类似单例模式,重复利用以存在对象。
"iDisplayLength" : 10,//每页默认显示数量
"iDisplayStart" : 0,
"dom": '<"top"f>rt<"bottom"lip><"clear">',//dom设计元素位置
"select": {
style: 'os',
selector: 'td:first-child'
},
// "bSort": false,
"aaSorting": [[ 3, "desc" ]],//排序方式
"ordering": true,//全局禁用排序
// "order": [[ 0, 'asc' ], [ 1, 'asc' ], [ 2, 'asc' ], [ 3, 'asc' ]],
// "ajax": { //ajax方式向后台发送请求
// "type": "POST",
// "url":"mvc/onDuty/find-user-duty",
// "data":{dutyUserId:uid},//传递的数据
// "dataType" : "json"
// },
"aoColumns" :"",
//渲染
"columnDefs": "",
"aoColumnDefs": [ { "bSortable": false, "aTargets": [1,2,3,4,6 ] }] //禁用排序的列码
}