skip to Main Content

Hi I have a following program. It works fine when iDisplayLength is 100. When we would like to change iDisplayLength as 200, the "Show ## entriesSearch" is empty. Is it be possible to customize "Show ## entriesSearch" in a way that entries over 200 shows ‘All’. Any idea to do so?

function newVasDataTable() {
    var $newVasTable = $('#vas_table').dataTable({
        "aoColumnDefs" : [ {"sSortDataType" : "dom-checkbox","aTargets" : [ 0 ]} ],
        "iDisplayLength" : 100
    });
    return $newVasTable;
}

2

Answers


  1. Chosen as BEST ANSWER

    I partially found the customization here. Limit of displaying rows in DataTables but it does not say how to show 'All' when over 200.

    function newVasDataTable() {
        var $newVasTable = $('#vas_table').dataTable({
            "aoColumnDefs" : [ {"sSortDataType" : "dom-checkbox","aTargets" : [ 0 ]} ],
            "iDisplayLength" : 200 ,
            "lengthMenu": [50, 100, 200],
            "pageLength": 200
        });
        return $newVasTable;
    }
    

  2. Seems you are working with an old version of datatables, so this may help you :

    function newVasDataTable() {
        var $newVasTable = $('#vas_table').dataTable({
            "aoColumnDefs" : [ {"sSortDataType" : "dom-checkbox","aTargets" : [ 0 ]} ],
            "iDisplayLength" : 100,
            "aLengthMenu": [[10, 25, 50, 100, 200, -1], [10, 25, 50,100, 200, "All"]]
        });
        return $newVasTable;
    }
    

    More info can be found here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search