Get all entries

Get all entries

vexvex Posts: 30Questions: 0Answers: 0
edited March 2009 in General
Hi,

It would be great if there was an option for getting all entries displayed at once. Ie, just another option in the dropdown stating 'all' that disables the pagination. Possibly also some configuration option to control if it should be enabled/disabled.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi vex,

    You can add this option using the oLanguage.sLengthMenu initialisation parameter:

    [code]
    $(document).ready(function() {
    $('#example').dataTable( {
    "oLanguage": {
    "sLengthMenu": 'Display '+
    '10'+
    '25'+
    '50'+
    'All'+
    ' records'
    }
    } );
    } );
    [/code]

    You will of course see that it isn't strictly all parameters (it would fall over after 100'000 records, at which point just add another 9...), but this is certainly the easiest way to add this option :-).

    Allan
  • vexvex Posts: 30Questions: 0Answers: 0
    Hi,

    Thanks for the quick fix.

    I think it would be nice if dataTabkes actually supported fetching _all_ entries even so. Ie, on value -1 retrieve all entries/disable pagination.

    That said, I sure hope I don't ever have to see a table with 100000 records though!
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi vex,

    I agree - there might indeed be an easy way of doing this (although I'll probably leave it off by default though incase people do have very long tables, to be overridden like the example above). I'll see if I can include this in the next beta.

    Allan
  • vexvex Posts: 30Questions: 0Answers: 0
    Hi again,

    Thanks! I don't mind it being turned off by default, I actually agree on that point! Just as long as there is an option to turn it on for those few cases where I actually need it. I'll stick with your quickfix while I eagerly await the next beta. Keep up the good work! :-)
  • CHgsdCHgsd Posts: 25Questions: 0Answers: 0
    I realize this is an old thread, but while searching for a get "All" entries option I found this thread. This then led me to find that you had indeed implemented this based on this page: http://www.datatables.net/usage/i18n
    Took me a bit to find the page, but eventually I did. Thank you for adding this!

    Cheers,

    CHgsd
This discussion has been closed.