gpt4 book ai didi

jquery - Trirand jqGrid 未显示; TypeError : $(. ..).jqGrid 不是函数

转载 作者:行者123 更新时间:2023-12-01 02:28:57 25 4
gpt4 key购买 nike

网格未显示,Firefox 控制台显示“TypeError: $(...).jqGrid 不是函数”。

ASP.NET MVC 5.2.2 Razor ,jQuery 2.1.1,Trirand jqGrid 4.6.0

我检查过其他类似的问题,每次问题看起来都不一样,要么是语法问题,要么是导入声明问题。我的看起来不错。所有引用的脚本均已就位。将其包装在 $( document ).ready() 事件中没有任何区别。感谢任何帮助。

<script type="text/css" src="@Url.Content("~/Content/themes/sunny/jquery-ui.sunny.min.css")">
</script>
<script type="text/css" src="@Url.Content("~/Content/jquery.jqGrid/ui.jqgrid.css")">
</script>
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery-2.1.1.min.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/i18n/grid.locale-en.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery.jqGrid.min.js")"></script>

<script>
$(function () {
$("#list").jqGrid({
url: "/Email/LoadDraftEmails/",
datatype: "json",
mtype: "GET",
colNames: ["Id", "Subject", "Sender name", "Sender e-mail", "Created", "Last saved"],
colModel: [
{ name: "ID", width: 50 },
{ name: "Subject", width: 200 },
{ name: "SenderName", width: 150 },
{ name: "SenderEmail", width: 150 },
{ name: "DateCreated", width: 150 },
{ name: "DateLatestSave", width: 150 }
],
pager: "#pager",
rowNum: 100,
rowList: [10, 20, 30],
sortname: "invid",
sortorder: "desc",
viewrecords: true,
gridview: true,
autoencode: true,
caption: "Draft emails"
});
});
</script>

<body>
<table id="list"><tr><td></td></tr></table>
<div id="pager"></div>
</body>

最佳答案

我怀疑您所显示的只是渲染的整个 HTML 的一小部分。也许布局中包含一些其他混合的脚本。

要确保情况并非如此,请临时关闭布局并将整个标记显示在 View 中:

@{
Layout = null;
}

<html>
<head>
<meta charset="utf-8" />
<title></title>
<script type="text/css" src="@Url.Content("~/Content/themes/sunny/jquery-ui.sunny.min.css")"></script>
<script type="text/css" src="@Url.Content("~/Content/jquery.jqGrid/ui.jqgrid.css")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery-2.1.1.min.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/i18n/grid.locale-en.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery.jqGrid.min.js")"></script>
<script>
$(function () {
$("#list").jqGrid({
url: "/Email/LoadDraftEmails/",
datatype: "json",
mtype: "GET",
colNames: ["Id", "Subject", "Sender name", "Sender e-mail", "Created", "Last saved"],
colModel: [
{ name: "ID", width: 50 },
{ name: "Subject", width: 200 },
{ name: "SenderName", width: 150 },
{ name: "SenderEmail", width: 150 },
{ name: "DateCreated", width: 150 },
{ name: "DateLatestSave", width: 150 }
],
pager: "#pager",
rowNum: 100,
rowList: [10, 20, 30],
sortname: "invid",
sortorder: "desc",
viewrecords: true,
gridview: true,
autoencode: true,
caption: "Draft emails"
});
});
</script>
</head>
<body>
<table id="list"><tr><td></td></tr></table>
<div id="pager"></div>
</body>
</html>

这通常应该按预期工作。如果是这种情况,您应该查看布局中可能混合了哪些脚本引用,并确保呈现的页面如下所示。

关于jquery - Trirand jqGrid 未显示; TypeError : $(. ..).jqGrid 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28134703/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com