表格:
<table id="table">
<thead>
<tr>
<th>x1</th>
<th>x2</th>
<th>x3</th>
<th>x4</th>
<th>x5</th>
<th>x6</th>
<th>x7</th>
<th>x8</th>
</tr>
<thead>
<tbody>
</tbody>
</table>
js片段,注意在fnDrawCallback事件中获取数据,根据数据的某些属性控制列(通过class)的显示。
不能在initComplete中控制列的属性,翻页失效且第二次加载数据时无法触发。
table = $('#table').DataTable({
serverSide: true,
ajax:{
type:"post",
url:"xx",
data:function(){
},
columns:[
{"data":'x1',"sclass":"c1"},
{"data":'x2',"sclass":"c1"},
{"data":'x3