JS Datatables超出自动添加滚动条

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/followwwind/article/details/78188986
<style type="text/css">
th, td {
white-space: nowrap;
}
</style>

<div class="table-responsive">
<table class="table table-striped m-b-none" id="tbl">
<thead>
<tr>
<th style="" class="text-center">
<label class="i-checks m-b-none">
<input type="checkbox" id="chkAll"><i></i>
</label>
</th>
<th style="" class="text-center">头像</th>
<th style="" class="text-center">姓名</th>
<th style="" class="text-center">联系电话</th>
<th style="" class="text-center">性别</th>
<th style="" class="text-center">创建时间</th>
<th style="" class="text-center">浏览次数</th>
<th style="" class="text-center">认证类型</th>
<th style="" class="text-center">认证状态</th>
<th style="" class="text-center">操作</th>
</tr>
</thead>
<tbody class="text-center">
</tbody>
</table>
</div>

$('#tbl').DataTable({
"ajax" : function (data, callback, settings) {
//封装请求参数
var param = {};
$scope.param.lineNumber = data.length;//页面显示记录条数,在页面显示每页显示多少项的时候
$scope.param.pageNumber = (data.start / data.length)+1;//当前页码
var returnData = {};
returnData.recordsTotal = 0;//返回数据全部记录
returnData.recordsFiltered = 0;//后台不实现过滤功能,每次查询均视作全部结果
returnData.data = [];//返回的数据列表
$http.post('/hb/UserInfo/getPageList.json', $scope.param).then(function(response){
//$log.info(response.data);
var resultData = response.data;
returnData.recordsTotal = resultData.totalCount;//返回数据全部记录
returnData.recordsFiltered = resultData.totalCount;//后台不实现过滤功能,每次查询均视作全部结果
returnData.data = resultData.result;//返回的数据列表
// $log.info(resultData);
callback(returnData);
}, function(err){
alert("数据加载请求异常");
});
},
"serverSide": true,
"language":$scope.datatables_lang, //提示信息
"renderer": "bootstrap", //渲染样式:Bootstrapjquery-ui
"pagingType": "full_numbers", //分页样式:simple,simple_numbers,full,full_numbers
"bFilter": true,
"bSort": false,
/*"scrollX": true,*/
"fnInitComplete": function (oSettings, json) {

},
"columns": []
})

展开阅读全文

没有更多推荐了,返回首页