Remove first and last pagination from jquery data table

I am currently using jQuery Datatable . I also use jquery ui to provide a good theme. However, I want to disable (hide) the first and last button paginated from the table using a small setting in the jquery library. enter image description here

The problem is that the setup has only 2 methods: full_numbers and two_button .

So how can I get the pagination without the first and last button ?

Any help would be greatly appreciated.

thanks

+4
source share
4 answers

Create your own javascript to hide / remove elements.

$(".first.paginate_button, .last.paginate_button").hide();

+3
source

You have 4 options:

  • simple - only the Previous and Next buttons
  • simple_numbers - Previous and Next buttons, as well as page numbers
  • full - buttons "first", "previous", "next" and "last"
  • full_numbers - "First", "Previous", "Next" and "Last", plus page numbers

So in your case:

 $("#youridtable").dataTable( { "pagingType": "simple_numbers" }); 

src: http://www.datatables.net/examples/basic_init/alt_pagination.html

+12
source

You can always use css

 .dataTables_paginate .last{display:none;} 
+1
source

We do not need to use CSS. Just crack the sFirst and sLast options for Datatable:

 $(document).ready( function() { $('#example').dataTable( { "oLanguage": { "oPaginate": { "sFirst": "", "sLast": "" } } }); }); 

Link: http://legacy.datatables.net/usage/i18n

+1
source

Source: https://habr.com/ru/post/1416112/


All Articles