Issues rendering DataTables.net in MVC partial view after adding JSON calls

Redbear

New Member
I'm trying to use datatables and jeditable for my project to render an editable table on the screen. This is displayed in a partial view that is called by the index. However, when I try to load it, it loads shows the html of the page on the screen instead of rendering it. Can someone tell me what I'm doing wrong to fix this?Here is my partial view:\[code\]<script type="text/javascript" src="http://stackoverflow.com/Scripts/jquery-1.9.1.js"></script><script type="text/javascript" src="http://stackoverflow.com/Scripts/FixedColumns.min.js"></script><script type="text/javascript" src="http://stackoverflow.com/Scripts/jquery.dataTables.js"></script><script type ="text/javascript" src="http://stackoverflow.com/Scripts/jquery.jeditable.mini.js"></script><script type="text/javascript" charset="utf-8">$(document).ready(function () { var oTable1 = $('#myDataTable').dataTable({ "bServerSide": true, "sAjaxSource": '/Home/PartialView', "fnDrawCallback": function () { $('#myDataTable tbody td:nth-child(2)').editable('/Home/Write/', { "callback": function (sValue, y) { oTable1.fnDraw(); }, }); } });})</script><table id ="myDataTable" class="display"> <thead> <tr> <th>Analysis ID</th> <th>Name</th> <th>Time</th> <th>Sample Type</th> <th>Grade</th> <th>Product ID</th> </thead> <tbody> </tbody></table>\[/code\]Call to the partial view in my index:\[code\] @if(ViewBag.SearchKey != null) { @Html.Action("PartialAnalysis", "Home", (string)ViewBag.SearchKey) {Html.RenderAction("PartialView", "Home", (string)ViewBag.SearchKey);} }\[/code\]My Controller:\[code\]public ActionResult PartialView(jQueryDataTableParamModel param, string Search) { PartialModel D = new PartialModel(); IEnumerable<PartialModel> model = D.SlagList; D.ViewDataPull(Search); return Json(new { sEcho = param.sEcho, iTotalRecords = D.List.Count(), iTotalDisplayRecords = D.List.Count(), aaData = http://stackoverflow.com/questions/15558922/D.List }, JsonRequestBehavior.AllowGet); }\[/code\]
 
Back
Top