0

I have added datatable plugin in my project and my datatable is displaying but the buttons ( excel, pdf, etc) are not rendered at all.

Here's my code snippet:

    table = $("#orders").DataTable({


                    dom: 'Bfrtip',
                    buttons: ['copy', 'csv', 'excel', 'pdf', 'print'],

....

Here's how it's rendered:

enter image description here

Here's my dependency list:

  bundles.Add(new ScriptBundle("~/bundles/lib").Include(
                       "~/Scripts/jquery-{version}.js",
                         "~/Scripts/jquery-ui-{version}.js",
                       "~/Scripts/bootstrap.js",
                       "~/Scripts/bootbox.js",
                       "~/Scripts/respond.js",
                       "~/Scripts/datatables/jquery.datatables.js",
                       "~/Scripts/datatables/datatables.bootstrap.js",
                       "~/Scripts/datatables/buttons.bootstrap.js",
                       "~/Scripts/datatables/buttons.html5.js",
                      "~/Scripts/datatables/buttons.print.js",
                       "~/Scripts/typeahead.bundle.js",
                       "~/Scripts/toastr.js",
                       "~/Scripts/moment.js"
                     ));

I am not getting the following error:

buttons.bootstrap.js:39 Uncaught TypeError: Cannot read property 'defaults' of undefined

I searched for this error and here it suggests to put the dependencies in order. But I do have my dependencies in order. Is there anything else I am missing ?

mcfred
  • 1,183
  • 2
  • 29
  • 68
  • "*Is there any dependency file that I am missing?*" How should anyone know? :) But it seems that you miss one of the files, like `buttons.html5.js` ... – davidkonrad Oct 07 '18 at 16:23
  • Have you included the Extension for buttons from DT download page? https://datatables.net/download/index – Sigma Oct 07 '18 at 17:03
  • My apologies for giving half the details. Please see my revised question. – mcfred Oct 08 '18 at 07:13

0 Answers0