1

我正在尝试为我的项目使用数据表和 jeditable 在屏幕上呈现可编辑的表。这显示在索引调用的局部视图中。但是,当我尝试加载它时,它会在屏幕上显示页面的 html 而不是渲染它。有人可以告诉我我做错了什么来解决这个问题吗?

这是我的部分观点:

<script type="text/javascript"  src="../../Scripts/jquery-1.9.1.js"></script>
<script type="text/javascript"  src="../../Scripts/FixedColumns.min.js"></script>
<script type="text/javascript" src="../../Scripts/jquery.dataTables.js"></script>
<script type ="text/javascript" src="../../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>

调用我的索引中的部分视图:

  @if(ViewBag.SearchKey != null)
  {

     @Html.Action("PartialAnalysis", "Home", (string)ViewBag.SearchKey)

     {Html.RenderAction("PartialView", "Home", (string)ViewBag.SearchKey);}

   }

我的控制器:

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 = D.List
        },
        JsonRequestBehavior.AllowGet);
    }
4

0 回答 0