Best practice loading multple table views on one page

Best practice loading multple table views on one page

dduffmandduffman Posts: 1Questions: 1Answers: 0

I'd like to initialize multiple tables on a page. I found https://datatables.net/examples/basic_init/multiple_tables.html and tried initializing by class. While this worked, I couldn't figure out how to customise the table filters or JSON source. It resulted in the same table being repeated multiple times.

I would like to either filter for certain rows, or call a different JSON source (which would look after the filtering for me).

It's currently working by initializing each table in full via it's ID. This seems very inefficent since I've now got 6 blocks of JS which all do almost the same thing. Is there a way to initialize multiple tables by class, but also specifying some custom changes to each table?

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,112Questions: 1Answers: 2,583
    Answer ✓

    You could set common defaults as explained here, then only set the values that differ for each table - that would reduce the code.

    Colin

This discussion has been closed.