问题
There is a project that uses angular-datatables. Now I need to remove "Show N entries" dropdown from a page with such table, but leave pagination untouched. For now i've found this way -
withOption('paging', false)
but this removes both!
Can anyone show me better way than just to remove them from DOM manually?
回答1:
Yes - paging
removes both since there is no need for showing the lengthmenu if the table not is paginated. Use the lengthChange option to control whether the lengthmenu should be visible or not :
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withOption('lengthChange', false);
demo -> http://plnkr.co/edit/0PnEwohCF9348uAf6OSD?p=preview
回答2:
Yes -
paging
removes both since there is no need for showing the lengthmenu if the table not is paginated. Use the [lengthChange
][1] option to control whether the lengthmenu should be visible or not :$scope.dtOptions = DTOptionsBuilder.newOptions() .withOption('lengthChange', false);
demo -> http://plnkr.co/edit/TKMyZ1CLvDUazGGImiCd?p=preview
[1]: https://datatables.net/reference/option/lengthChange
it's still there.
vm.dtOptions = DTOptionsBuilder.newOptions().withPaginationType('full_numbers')
.withDisplayLength(10)
.withOption('lengthChange', false);
回答3:
You try add follow option to dtOptions:
.withLanguage({
"sInfoFiltered": ""
})
来源:https://stackoverflow.com/questions/32894201/angular-datatables-how-to-remove-show-n-entries-but-leave-pagination