TypeError:$(...)。jqGrid不是函数标题:'通过数组加载学生列表'

时间:2014-05-18 04:47:00

标签: javascript jquery asp.net-mvc json jqgrid

加载索引视图时出现上方错误。 我想使用jquery网格插件实现JQGrid

我在View中包含JS文件的数量,并且还包含JQGrid的CSS。而不是我不能通过使用JQGrid插件创建网格所以请帮助我,我已经使用JQGrid 4.6.0版本所以请帮助我

    <link href="@Url.Content("~/Content/jqGrid/css/ui.jqgrid.css")" rel="stylesheet" type="text/css" />    
    <link href="@Url.Content("~/Content/jqGrid/css/ui.all.css")" rel="stylesheet" type="text/css" />
    <script src="~/Content/jqGrid/js/jquery-1.9.0.min.js"></script>
    <link href="~/Content/jqGrid/css/jquery-ui-1.9.2.custom.css" rel="stylesheet" />
   <script lang="javascript" type="text/javascript" src="@Url.Content("~/Content/JQGrid/src/jqModal.js")"></script>
    <script lang="javascript" type="text/javascript" src="@Url.Content("~/Content/JQGrid/src/jquery.jqGrid.js")"></script>
    <script lang="javascript" type="text/javascript" src="@Url.Content("~/Content/JQGrid/src/jqDnR.js")"></script>
    <script lang="javascript" type="text/javascript" src="@Url.Content("~/Content/JQGrid/src/i18n/grid.locale-en.js")"></script>

------------- html --------表格为网格---------             ------------- SCript Part -------------

  $(document).ready(function (e)
        {

            $("#student-grid-json").jqGrid({
                url: "/Demo/GetStudents",
                datatype: "json",
                colNames: ["Student ID", "Name", "Course", "Year"],
                colModel: [
                            { name: "StudentID", index: "StudentID" },
                            { name: "Name", index: "Name" },
                            { name: "Course", index: "Course" },
                            { name: "Year", index: "Year", sorttype: "int" }
                ],
                rowNum: 50,
                rowList: [20, 50, 100],
                pager: "#pager-json",
                sortname: "StudentID",
                sortorder: "ASC",
                viewrecords: true,
                caption: "Student List - Loading via JSON"
            });

            $("#student-grid-array").navGrid("#pager-json", { edit: false, add: false, del: false, search: false, refresh: false });

        });  

1 个答案:

答案 0 :(得分:2)

发现了问题。这是图书馆的订单

 <link href="@Url.Content("~/Content/jqGrid/css/ui.jqgrid.css")" rel="stylesheet" type="text/css" />    
<link href="~/Content/jqGrid/css/jquery-ui-1.9.2.custom.css" rel="stylesheet" />
<link href="@Url.Content("~/Content/jqGrid/css/ui.all.css")" rel="stylesheet" type="text/css" />
 <script src="~/Content/jqGrid/js/jquery-1.9.0.min.js"></script>
 <script lang="javascript" type="text/javascript" src="@Url.Content("~/Content/JQGrid/src/jquery.jqGrid.js")"></script>  
 <script lang="javascript" type="text/javascript" src="@Url.Content("~/Content/JQGrid/src/jqModal.js")"></script>

 <script lang="javascript" type="text/javascript" src="@Url.Content("~/Content/JQGrid/src/jqDnR.js")"></script>
 <script lang="javascript" type="text/javascript" src="@Url.Content("~/Content/JQGrid/src/i18n/grid.locale-en.js")"></script>

这是正确的顺序。你把模态放在jqgrid.js之前就出问题了