Search code examples
javascriptjquerydatatables

customize "Show ## entriesSearch" for dataTable in JavaScript


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;
}

Solution

  • 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