Antt
Antt

Reputation: 159

AngularJS Datatables with display length but without pagination

I'm working with angular-datatables.

My end goal is to have a table with no pagination but with a "link" that allow to "show 25 more entries" (and without using the select length "10", "25", "50","100" etc).

So first of all, I set the display length to 25 with :

this.dtOptions = DTOptionsBuilder.newOptions()
    .withBootstrap()
    .withDisplayLength(25)

Great my table is showing only 25 five entries with pagination. No I try to disable the pagination with :

this.dtOptions = DTOptionsBuilder.newOptions()
   .withBootstrap()
   .withDisplayLength(25)
   .withOption('paging', false)

And then the pagination is disable but the table is showing more than 25 entries.
I get that it's kind of logic since otherwise there will be no means to acces those 25+ entries but that's what i'd liked to acheive.

Thanks

Upvotes: 2

Views: 2648

Answers (1)

davidkonrad
davidkonrad

Reputation: 85538

I would simply hide the injected pagination element when the table is finished rendering :

.withOption('drawCallback', function() {
   $('.dataTables_paginate').hide()
})

.dataTables_paginate is the overall <div> where dataTables places the pagination control, if any.

Upvotes: 1

Related Questions