Can't add Datatables plugin

5 czerwca 2020 21:04:29
  • Wysłany: 2 listopada 2019 00:03
  • 2
I am trying to add DataTables plugin to one of my pages and no matter where I put the js and css links I get errors. I tried head.cshtml in DefaultClean and the root body and head as well and I still causes javascript errors. I even tried in the body of the cshtml view I am creating. Examples. Am I putting the right references?

CSHTML:
$(document).ready(function() {
    $('#example').DataTable();
} );

Head.cshtml:
Html.AppendScriptParts(ResourceLocation.Footer, "~/scripts/DataTables/datatables.min.js", themeName);
Html.AppendCssFileParts(ResourceLocation.Head, "~/scripts/DataTables/datatables.min.css", themeName);

or SampleView.cshtml:

@*<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.js"></script>*@ <----Already included in head.cshtml right?
    <script type="text/javascript" src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css" />

Errors:
jquery.min.js:2 Uncaught TypeError: $(...).DataTable is not a function
at HTMLDocument.<anonymous> (localhost/:2343)
at l (jquery.min.js:2)
at c (jquery.min.js:2)
0
  • Wysłany: 5 listopada 2019 09:52
  • Moderator
  • 571
We don't use DataTables in GrandNode. Is it related with GrandNode plugin?
Best regards,
Patryk

GrandNode Team
0
back to top
Filters