Encapsulating Data Tables code

Encapsulating Data Tables code

wxkevinwxkevin Posts: 11Questions: 0Answers: 0
edited December 2011 in General
I need to create a custom date sorting function as the one Data Tables provide doesn't work properly for our format.

We are going to have 3 dozen plus different tables which will be separated into numerous Javascript files. Is it possible to put this new sorting functions in its own Javascript file so that it can be reused? I don't want to cut and paste the same sorting function to all the different files.

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    yes. it doesn't matter where the sort routine is defined, so long as it is included before you need it.
  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    Just to add to what fbas says, there is a code demo of what you are looking for here: http://datatables.net/plug-ins/sorting#how_to_type (although not a running demo).

    Allan
This discussion has been closed.