Having a issue regarding DataTables paggingType = "input"

i'm using datatables and for pagination i've used paggingtype = "input" and also included its plugin cdn but unfortunately when i used this, it is automatically disabling the First Next Previous and Last pagination buttons and i needed them enabled so that i can use them alongwith input text field.. Any help will be a huge favor

Here's my JavaScript:

$(document).ready(function () {
    $('#categories').DataTable({
        "processing" : true,
        "pagingType" : "input",
        "ajax" : {
            "url" : ajaxurl + "/ManageCategories/fetchCategories",
            "type" : "POST"
        }
    });
});

and here's my DataTable showing output: enter image description here

thanks, Ameer

2 answers

  • answered 2018-11-08 08:01 Ameer Hamza Nasir

    I got a solution to my question i.e. whenever "paggingType" is used it will overwrite the default "paggingType" so in order to get a text input i can add it manually by inserting this javaScript:

    $("div.toolbar").html('<div><input type="text" id="pageJump" placeholder="page"> 
    <button id="jump" type="button">Go</button></div>');
    
    $('#jump').click( function() {
    table.page(parseInt($('#pageJump').val())-1).draw(false);
    }) 
    

  • answered 2018-11-08 08:09 Abdulla Nilam

    try simple_numbers and check

    "pagingType": "simple_numbers"
    

    simple_numbers: function ( page, pages ) {
        return [ 'previous', _numbers(page, pages), 'next' ];
    },
    

    simple_numbers - 'Previous' and 'Next' buttons, plus page numbers

    pagingType Datatables