Calling multiple extensions - Noob

Calling multiple extensions - Noob

creatorDotJScreatorDotJS Posts: 20Questions: 6Answers: 0

http://bylicia.com/datatablehelp/ (my code is located at the top of main.js)

Any advice on the best way to call multiple extensions? I have four datatables. Each one under different jQuery UI tabs. I want all the tables to behave the same way.

I want to add ColReorder and ColVis.
Current (incorrect) code

$('table.display').dataTable( {
    "scrollY": "500px", //scrolling
    "scrollCollapse": true,
    "paging": true,
    "jQueryUI": true,
    stateSave: true, //save state even after exiting
    "dom": 'C<"clear">lfrtip', //column show/hide button and choices ColVis
    "dom": 'Rlfrtip'//ColReorder
} );

My jQueryUI Themeroller also has some formatting errors once I added the Scroll function for jQueryUI - the spacing is off and the background of the table is now white instead of a dark blue. I can address this in another questions, but thought I would throw it out there.

Thank you in advance for any help.

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    edited July 2014

    You can only define one "dom" parameter. Currently your second one will just overwrite the first.

  • creatorDotJScreatorDotJS Posts: 20Questions: 6Answers: 0

    Thanks Tangerine. Right, it is overriding the first. What would be the best way to go about adding and calling multiple extensions. Is it possible? Thanks!

  • allanallan Posts: 63,512Questions: 1Answers: 10,472 Site admin
    Answer ✓

    Sure - just add the R into the first one :-).

    As the documentation for dom says:

    Each table control element in DataTables has a single letter associated with it, and that letter it used in this dom configuration option to indicate where that element will appear in the document order.

    In the case of ColReorder the letter to activate the feature is R and the ColVis letter is C - so just make sure your dom string includes both.

    I do want to rewrite the dom option to be easier to use at some point, but I've yet to come up with a better way of doing it!

    Allan

  • creatorDotJScreatorDotJS Posts: 20Questions: 6Answers: 0

    Oh my! That makes so much sense now. It works and was very easy to fix. Thank you for clarifying and the dom documentation made sense. Thank you, thank you!

This discussion has been closed.