Disable DataTables procesing on large datasets

Disable DataTables procesing on large datasets

owannekeowanneke Posts: 3Questions: 0Answers: 0
edited March 2014 in DataTables 1.9
I deployed DataTables on an existing application with hundreds of reports and pages.
These pages use different datasources and inputs, so switching all of them to server side rendering takes (a lot of) time.

Is it possible to use iTotalRecords to "disable" DataTables if it exceeds a certain value and just render the table as it's source HTML, without the DataTables options on them until I can change the page to using ssr?

I cannot add an example as it's an internal application with confidential data, yet for the concept of the question I don't think it's mandatory?

Replies

  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin
    I'm afraid I don't quite understand. Basically you want to either initialise a table as a DataTable or not? iTotalRecords is only going to be relevant once a table is initialised, so I don't see how it would be relevant?

    If you want to not initialise DataTables on large HTML tables you could do something trivial like:

    [code]
    if ( $('#myTable tbody tr').length < 1000 ) {
    $('#myTable').dataTable();
    }
    [/code]

    Allan
  • owannekeowanneke Posts: 3Questions: 0Answers: 0
    I was not certain at which point iTotalRecords was calculated; but indeed, moving this check outside of the DataTable process itself and back into the surrounding JQuery is a good solution.
This discussion has been closed.