Dealing with multiple instances of "Individual column searching (text inputs)" on a page
Dealing with multiple instances of "Individual column searching (text inputs)" on a page
Most of the pages on my website use the code provided on page "Individual column searching (text inputs)" at http://www.datatables.net/examples/api/multi_filter.html. This is usually no big deal, but I have a few pages containing not one, two, or three tables, but twenty, if not more. I was wondering if there was a way of simply inserting only one instance of the twenty-one lines of code in a given page, ideally in the template (I am using Dreamweaver), and use the standard $(document).ready(function()
with a parameter referring to the name of the table for each instance. Since the searching code includes four instances of #example
, would it be possible to have a variable instead of a hard-coded string? What I did is to copy the twenty-one lines before each table and manually modify the "#example" string to read #myTable1
, #myTable2
, etc. This is quite cumbersome and leads to much superfluous coding. An example can be found at http://www.mus.ulaval.ca/roberge/srs/10-datatables2.htm.
Answers
Look at "Setting defaults", https://www.datatables.net/manual/options.
You might find it useful, although tbh I'm not entirely sure I understand your needs.
P.S. Nice site!