Tepken Vannkorn
Tepken Vannkorn

Reputation: 9713

Remove first, and last pagination from the jquery data table

I'm currently using jQuery Datatable. I also use jquery ui to provide good theme. However, I want to disable (hide) the first and last button of the pagination from the table by using a bit customization on jquery library. enter image description here

The problem is that the customization 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 very much appreciated.

Thanks

Upvotes: 4

Views: 15368

Answers (4)

jteks
jteks

Reputation: 641

You have 4 options:

  • simple - 'Previous' and 'Next' buttons only
  • simple_numbers - 'Previous' and 'Next' buttons, plus page numbers
  • full - 'First', 'Previous', 'Next' and 'Last' buttons
  • full_numbers - 'First', 'Previous', 'Next' and 'Last' buttons, plus page numbers

So in your case :

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

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

Upvotes: 16

Chung
Chung

Reputation: 975

We do not need to use CSS. Just hack into sFirst and sLast options of Datatable:

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

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

Upvotes: 1

user969714
user969714

Reputation: 165

You can always use css

.dataTables_paginate .last{display:none;}

Upvotes: 1

Rahul
Rahul

Reputation: 1876

Write your own javascript to hide/remove the elements.

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

Upvotes: 4

Related Questions