Setting new default values

Setting new default values

TobiasTobias Posts: 8Questions: 0Answers: 0
edited February 2010 in General
Okay, here is another question: I use the datatable in a lot of pages with mostly identical init-code. How and where do I store there default-values, so that I don't have to set them every time? I'm sure, this is an easy task, but right now, I don't see the way... :/

Replies

  • allanallan Posts: 63,700Questions: 1Answers: 10,501 Site admin
    There are two ways off the top of my head:

    1. Alter the defaults in DataTables JS file - search for "classSettings" in the code - all the defaults are in there.

    2. A possibly nicer method since it doesn't alter the distribution code is to create a base object with the settings you want which are common to all tables, and then 'duplicate' that using $.extend() for each table, and modify the cloned object for each specific table as required.

    Hope that helps,
    Allan
  • TobiasTobias Posts: 8Questions: 0Answers: 0
    Thank you for your helpful answer, works fine and was indeed an easy task :)
This discussion has been closed.