<!-- 表格 -->
<div class="col-xs-12">
<table id="sampleTable" class="table table-striped table-bordered table-hover" style="width: 100%;">
<thead>
<tr>
<th>序号</th>
<th>客户姓名</th>
<th>证件号码</th>
<th>证件类型</th>
<th>联系方式</th>
<th>电子邮箱</th>
<th>提交日期</th>
<th>协议单号</th>
<th>来源</th>
</tr>
</thead>
</table>
</div>
$(function(){
table= $('#sampleTable').DataTable({
"searching":false, //屏蔽datatales的查询框
//"bLengthChange": false, //去掉每页显示多少条数据方法
"scrollX":true,
"sScrollX":true,
"order": [],
"lengthMenu":[10, 20, 30],
"bServerSide": true, //从服务端获取数据
"sAjaxSource":"/protocol/queryProtocolDetail",
"language": {
"decimal": "",
"emptyTable": "没查询到相关数据",
"info": "显示 _START_ 到 _END_ 条共 _TOTAL_ 条",
"infoEmpty": "显示 0 到 0 条共 0 条",
"infoFiltered": "",
"infoPostFix": "",
"thousands": ",",
"lengthMenu": "显示 _MENU_ 条",
"loadingRecords": "Loading...",
"processing": "Processing...",
"search": "搜索:",
"zeroRecords": "没有匹配项",
"paginate": {
"first": "First",
"last": "Last",
"next": "下页",
"previous": "上页"
}
},
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({"name":"reserved1","value":$("#reserved1").val()},{"name":"reserved2","value":$("#reserved2").val()},{"name":"reserved3","value":$("#reserved3").val()}
,{"name":"reserved4","value":$("#reserved4").val()})
$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
});
},
//序号自增
"fnDrawCallback" : function(){
this.api().column(0).nodes().each(function(cell, i) {
cell.innerHTML = i + 1;
});
},
"columns":[
{"data":null,"orderable":false}, //在此列中加序号,设置其值为空
{"data":"riskName","orderable":false},
{"data":"riskCoverage","orderable":false,"render":getCoverage},
{"data":"corporation","orderable": false},
{"data":"createDate","orderable": false}
]
});
})