Reduce number of page numbers (from 7) to current page, next page, and previous page only

Reduce number of page numbers (from 7) to current page, next page, and previous page only

Azima1993Azima1993 Posts: 5Questions: 3Answers: 0

I need to reduce number of page numbers (max 7) to only current ( say 4), next page (say 5), and previous page(say 3), with previous and next buttons intact. How can I do that?

Answers

  • allanallan Posts: 61,723Questions: 1Answers: 10,108 Site admin
    $.fn.DataTable.ext.pager.numbers_length = 5;
    

    should do it.

    Allan

  • allanallan Posts: 61,723Questions: 1Answers: 10,108 Site admin

    If you don't want the numbers at all, use the full option of the pagingType option.

    Allan

  • Azima1993Azima1993 Posts: 5Questions: 3Answers: 0
    edited November 2017

    @allan
    $('#requestTable').DataTable({
    "bPaginate": true,
    "bLengthChange": true,
    "bFilter": true,
    "bSort": false,
    "bInfo": true,
    "order": [[1, 'desc']],
    "aLengthMenu": [10, 20, 30],
    'iDisplayLength': 5,
    "bAutoWidth": false,
    // "pagingType": "full",
    stateSave: true
    });
    $.fn.DataTable.ext.pager.numbers_length = 5;
    This is how I tried, but it is not working. How should I put it?

  • allanallan Posts: 61,723Questions: 1Answers: 10,108 Site admin

    Put the static setting before you initialise the DataTable: http://live.datatables.net/molifaqi/1/edit .

    Allan

This discussion has been closed.