Я пытаюсь работать с jQuery Datatable JS для своего проекта по этой ссылке.
Я скачал полную библиотеку из того же источника. Кажется, все примеры, приведенные в пакете, работают нормально, но когда я пытаюсь включить их в свой
WebForms, CSS, JS вообще не работают.
Вот что я сделал:
My file structure for the JS and CSS in my Solution looks as follows :
I have added all the necessary JS and CSS references as shown in the manual. Still the rendering isn't as expected. There is no CSS and even the JS doesn't work.
Also in the console i get the following errors:
ReferenceError: jQuery is not defined TypeError: $(...).DataTable is not a function
I have still not bound any dynamic data here (like within a repeater or so) still it is not working.
Can someone please guide me in the right direction for this problem ?
There could be multiple reasons for this error.
Include only one version of jQuery library version 1.7 or newer before jQuery DataTables.
This worked for me. But make sure to load the jquery.js before the preferred dataTable.js file. Cheers!
I got this error because I found out that I referenced jQuery twice.
The first time: on the master page (
_Layout.cshtml) in ASP.NET MVC, and then again on one current page so I commented out the one on the master page.
If you are using ASP.NET MVC this snippet could help you
and in the current page I added these lines
Hope this help you even if don't use ASP.NET MVC
if some reason two versions of jQuery are loaded (which is not recommended), calling
$.noConflict(true)from the second version will return the globally scoped jQuery variables to those of the first version.
Sometimes it could be issue with older version (or not stable) of JQuery files
Here is the complete set of JS and CSS required for the export table plugin to work perfectly.
Hope it will save your time
There can be two reasons for that error:
You are loding
jquery.jsso for that :-
You need to load
jQuery.jsbefore you load
You are using two versions of
jQuery.json the same page so for that :-
Try to use the higher version and make sure both links have same version of
Honestly, this took hours to get this fixed. Finally only one thing worked a reconfirmation to solution provided by "Basheer AL-MOMANI". Which is just putting statement
_Layout.cshtmlfile after all
<script></script>elements and also commenting the jquery script in the same file. Secondly, I had to add
within jquery function call at another *.cshtml file as:
I ran into this error also. For whatever reason I had originally coded
This would not throw the error sometimes and other times it would. By changing code to
Error appears to have stopped
I know its late Buy can help someone
This could also happen if you don't add
So instead of this
In my case the solution was to delete cookies from the browser.
Having the same issue in Flask, I had already a template that loaded JQuery, Popper and Bootstrap. I was extending that template into other template that I was using as a base to load the page that had the table.
For some reason in Flask apparently the files in the outer template load before the files in the tables above in the hierarchy (the ones you are extending) so JQuery was loading before the DataTables files causing the issue.
I had to create another template where I run all my imports of JS CDNs in the same place, that solved the issue.