我想检查jquery DataTable中的总记录并隐藏/显示“找不到记录”消息。目前我检查了“fnDrawCallback”部分中的总行数,但是当我导航太快时,我显示“没有找到记录”:
//Instantiate the Datatable
function configureDataTable() {
var url = prepareURLforDataTable();
$scope.table = $('#example').dataTable({
"bServerSide": true,
"sAjaxSource": url,
"sAjaxDataProp": "aoData",
"bProcessing": false,
"bDestroy": true,
"bPaginate": true,
"bInfo": true,
"bSort": false,
"searching": false,
"bLengthChange": false,
"iDisplayLength": 7,
"fnDrawCallback": function (oSettings) {
//to hide or show no record message
var rowsData = $('#example').DataTable().rows().data();
$scope.count = rowsData.length;
if ($scope.count == 0) {
$scope.ShowNoRecordMsg();
}
else {
$scope.HideNoRecordMsg();
}
$rootScope.hideSpinner();
//other operations
我有两个Div第一节用于“无记录”,另一个用于“对话表”。 $ scope.ShowNoRecordMsg& $ scope.HideNoRecordMsg从“no records”div&中删除 display:none “会话表”div分别为..