Getting error when trying to enable any of the extensions

Getting error when trying to enable any of the extensions

rwkiiirwkiii Posts: 13Questions: 5Answers: 0
edited July 2014 in Free community support

Every one of the extensions I attempt to enable are generating the same error:

TypeError: $.fn.dataTable.ColVis is not a constructor

or

TypeError: $.fn.dataTable.FixedHeader is not a constructor

etc.

I've tried initializing the DataTable with a lowercase 'd' and uppercase 'D', but either way I get an error. I've tried placing the initializer inside the $(document).Ready and outside. Some of the extensions are super cool and would be a big benefit to our tables.

    $(document).ready(function () {

        var table = $('#jsonajaxtable').DataTable({
            "dom": 'C<"clear">lfrtip',

            [... omitted for brevity ...]

    });

    new $.fn.dataTable.FixedHeader(table);

    var colvis = new $.fn.dataTable.ColVis(table);
    $(colvis.button()).insertAfter('div.info');

I've seen examples showing the dom option in quotes and without quotes. I see examples using dataTable and DataTable. I don't understand what <"clear"> in the dom option means and I can't find where the dom option is even documented.

Can someone help me out by telling me where I'm going wrong on getting any of the extensions to work? :S

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,348Questions: 36Answers: 394
    Answer ✓

    You need to link to the relevant js script to use the extensions.

    The dom is documented here: http://datatables.net/reference/option/dom

  • rwkiiirwkiii Posts: 13Questions: 5Answers: 0

    Hi Tangerine. Yes... you are right. That's what I get for assuming. I haven't seen anywhere where the scripts needed to be included and so I assumed DataTables included them all automatically. I have it working now. ;)

This discussion has been closed.