Aleksei Yerokhin
Aleksei Yerokhin

Reputation: 879

angular-datatables : How to remove "Show N entries" but leave pagination

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?

Upvotes: 1

Views: 7797

Answers (3)

davidkonrad
davidkonrad

Reputation: 85538

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

Upvotes: 5

TVT. Jake
TVT. Jake

Reputation: 275

You try add follow option to dtOptions:

.withLanguage({
            "sInfoFiltered": ""
        })

Upvotes: 0

jjjjjj
jjjjjj

Reputation: 35

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);

Upvotes: 0

Related Questions