Why PageLength isn't working ?

Why PageLength isn't working ?

DaniDeeDaniDee Posts: 3Questions: 1Answers: 0
edited July 2017 in Free community support

Hi, got a table with this options :

(document).ready(function() {
    $('#sample-table-1').DataTable( {
        "language": {
            "lengthMenu": "Afficher _MENU_ prestataire par page",
            "pageLength": 50,
            "zeroRecords": "Aucun résultat",
            "info": " page _PAGE_ sur _PAGES_",
            "infoEmpty": "Pas de résultat disponible",
            "infoFiltered": "(filtered from _MAX_ total records)"
        }
    } );
} );

But pageLength dont work, i mean, my table sort only 10 result, thanks

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,310Questions: 26Answers: 4,948
    edited July 2017

    I don't think there is a pageLength option for language. You can move it outside of your language definition for it to work. Here is the doc: pageLength.

    Kevin

  • DaniDeeDaniDee Posts: 3Questions: 1Answers: 0
    edited July 2017

    when i write :

    $(document).ready(function() {
        $('#sample-table-1').DataTable( {
            "language": {
                "lengthMenu": "Afficher _MENU_ prestataire par page",
               
                "zeroRecords": "Aucun résultat",
                "info": " page _PAGE_ sur _PAGES_",
                "infoEmpty": "Pas de résultat disponible",
                "infoFiltered": "(filtered from _MAX_ total records)"
            }
     "pageLength": 50
        } );
    } );
    

    DataTable don't work.
    Thanks,

    Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

  • kthorngrenkthorngren Posts: 21,310Questions: 26Answers: 4,948
    Answer ✓

    If you look at the browsers console you likely have a syntax error. You are missing a comma, see below:

    $(document).ready(function() {
    $('#sample-table-1').DataTable( {
    "language": {
    "lengthMenu": "Afficher MENU prestataire par page",
    "zeroRecords": "Aucun résultat",
        "info": " page _PAGE_ sur _PAGES_",
        "infoEmpty": "Pas de résultat disponible",
        "infoFiltered": "(filtered from _MAX_ total records)"
    },   //need comma here
    "pageLength": 50
    } );
    } );
    

    Kevin

  • DaniDeeDaniDee Posts: 3Questions: 1Answers: 0

    Thanks it's working now :)

This discussion has been closed.