What older versions of DataTables would you say has the smallest file size and stability?

What older versions of DataTables would you say has the smallest file size and stability?

rotaerczrotaercz Posts: 31Questions: 7Answers: 0
edited July 2018 in Free community support

What older versions of DataTables would you say has the smallest file size and yet very stable?

Multiple version suggestions are fine too.

This question has accepted answers - jump to:

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @rotaercz ,

    The most recent ones tend to be the most stable, as they'll have the most fixes. The sizes probably doesn't change much between the versions.

    Cheers,

    Colin

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin
    Answer ✓

    The smallest would be the initial release, but equally it has the least features. For stability, without question its the latest release. We rarely (if ever) back ported fixes to other 1.x versions since they are all backwards compatible.

    DataTables core weighs in about 82Kb minified - probably around 25Kb gzipped. If you didn't need the API you could built it from source without the API which would save a decent chunk of that.

    Allan

  • rotaerczrotaercz Posts: 31Questions: 7Answers: 0
    edited July 2018

    Oooh, I see. That's really interesting. I'm only using a tiny portion of the API. Is there an easy way to just have it save the parts of the API that I'm actually using?

    EDIT: Based on https://datatables.net/reference/api/ I think I'm only using the API for:

    DataTables - Core
    DataTables - Cells
    

    When I initialize $('#dt').DataTable(), are lengthMenu, order, deferRender, etc. also considered a part of the API?

    Man, DataTables is impressive.

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin
    Answer ✓

    You could go through the files and remove the API methods that you don't want, but you'll almost certainly run into compatiblity issues if you then want to use any of the extensions / plug-ins.

    At some point I'll go through the core and figure out the size of each feature. Scrolling is a bit of a beast for example.

    Allan

  • rotaerczrotaercz Posts: 31Questions: 7Answers: 0
    edited July 2018

    That's good to know. I'm not using any extensions or plugins so maybe this is the way to go. I'm trying to decrease my Javascript size since I'm building for mobile and my Javscript is currently 10 times larger than my HTML.

    I'm thinking maybe I'll just go through the file that's not been minified and comment out the functions that aren't being using and test to make sure everything still works and then create a minified version of that.

    Do you think this would work?

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin
    Answer ✓

    Yes that should work. Just be careful to remove only the functions you don't use! Also keep in mind that upgrading in future will be a right pain.

    Allan

  • rotaerczrotaercz Posts: 31Questions: 7Answers: 0

    Thank you!

This discussion has been closed.