Click here to Skip to main content
15,890,670 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I got in my jquery data table. i have tried this on .aspx but when i tried it in MVC I got this error.

What I have tried:

my jquery .
$(document).ready(function () {
var t = $('#sample_editable_1x').DataTable();
var Raw="";
$('#sample_editable_1_new').on('click', function () {
t.row.add([
Raw + '',
Raw + '',
Raw + '',
Raw + '',
Raw + ' edit ',
Raw + ' delete '
]).draw(false);
});
});

in _layout page

@Scripts.Render("~/Content/Metro/global/scripts/datatable.js")
@Scripts.Render("~/Content/Metro/global/plugins/datatables/datatables.min.js")
@Scripts.Render("~/Scripts/jquery-1.10.2.js")
Posted
Updated 3-Oct-16 0:46am
Comments
Karthik_Mahalingam 3-Oct-16 12:18pm    
try creating a simple page , add the reference and check whether it actually works

1 solution

Try re-ordering the scripts so that jquery is before the plug-ins, and you are also including the plug-in twice; the normal version (which you can read) and the minified version (which you'll struggle to read). You should only reference it once.

@Scripts.Render("~/Scripts/jquery-1.10.2.js")
@Scripts.Render("~/Content/Metro/global/plugins/datatables/datatables.min.js")


There may still be other issues with your code, though, your own js needs to execute after the scripts.render statements too.
 
Share this answer
 
Comments
T_Sub 3-Oct-16 8:01am    
fix those errors but same error.
F-ES Sitecore 3-Oct-16 9:01am    
It's hard to help from the little info you've given. Use the console of the browser's dev tools and look at the network section also to make sure your scripts are loading and in the right order, also make sure your own code runs after the scripts are included on the page.
T_Sub 26-Oct-16 7:20am    
Thank You very much !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900