user3732216
user3732216

Reputation: 1589

Show first and last buttons in pagination for Datatables

This is from a template I purchased and I'm trying to figure out where to apply the pagingType of full_numbers to the following code so that I can see both the first and last pages in pagination.

$.components.register("dataTable", {
  defaults: {
    responsive: true,
    language: {
      "sSearchPlaceholder": "Search..",
      "lengthMenu": "_MENU_",
      "search": "_INPUT_",
      "paginate": {
        "previous": '<i class="icon wb-chevron-left-mini"></i>',
        "next": '<i class="icon wb-chevron-right-mini"></i>'
      }
    }
  },
  api: function() {
    if (!$.fn.dataTable) return;

    if ($.fn.dataTable.TableTools) {
      // Set the classes that TableTools uses to something suitable for Bootstrap
      $.extend(true, $.fn.dataTable.TableTools.classes, {
        "container": "DTTT btn-group btn-group pull-left",
        "buttons": {
          "normal": "btn btn-outline btn-default",
          "disabled": "disabled"
        },
        "print": {
          "body": "site-print DTTT_Print"
        },
      });
    }
  },
  init: function(context) {
    if (!$.fn.dataTable) return;

    var defaults = $.components.getDefaults("dataTable");

    $('[data-plugin="dataTable"]', context).each(function() {
      var options = $.extend(true, {}, defaults, $(this).data());

      $(this).dataTable(options);
    });
  }
});

Upvotes: 1

Views: 4043

Answers (1)

Gyrocode.com
Gyrocode.com

Reputation: 58880

If you want it to apply to all tables, use the code below:

$.components.register("dataTable", {
   defaults: {
      pagingType: 'full_numbers',
      responsive: true,
      // ... skipped ... 

Upvotes: 1

Related Questions