Chr*_*ris 5 asp.net-mvc jquery kendo-grid
早些时候和前几天,我从来没有得到这个错误,我收到数据返回,但由于这个错误它不会显示数据
UnCaught TypeError $(...).kendoGrid不是一个函数
我的网格是这个..
function ShowAdministratorsGrid(administratorData) {
$("#adminGrid").kendoGrid({
dataSource: {
data: administratorData
},
columns: [{
field: "administratorID",
title: "AdministratorID",
hidden: true
},
{
field: "administratorName",
title: "AdministratorName"
},
{
field: "dateCreated",
title: "DateCreated"
},
{
field: "createdBy",
title: "CreatedBy"
}],
scrollable: true,
sortable: true,
pageable: false,
selectable: "row",
change: function (e) {
onRowSelectForAdministrator();
},
height: 275
});
}
Run Code Online (Sandbox Code Playgroud)
我这样填充它..
function ShowAdministratorsInformation() {
$.ajax({
type: "GET",
url: AddURLParam.AddGetAdminInformationURL,
dataType: "json",
contentType: "application/json; charset=utf-8",
success: function (data, textStatus, jqXHR) {
ShowAdministratorsGrid(data);
}
})
}
Run Code Online (Sandbox Code Playgroud)
但正如我所提到的那样,它一直工作到早些时候,我不知道为什么会抛出这个错误.我一直在寻找与kendoGrid有关的这个错误无济于事.
所以直到一两个小时前一切正常.
Kal*_*lah 13
记录的解决方案:此问题已记录在案.它说:
小部件不可用或未定义:
如果在页面中多次包含jQuery,则所有现有的jQuery插件(包括Kendo UI)都将被删除.如果未包含所需的Kendo JavaScript文件,也会发生.
根据浏览器的不同,将抛出以下JavaScript错误:
TypeError: Object #<Object> has no method kendoGrid (in Google Chrome)
TypeError: $("#Grid").kendoGrid is not a function (in Firefox)
Object does not support property or method 'kendoGrid' (in Internet Explorer 9 and later)
Object does not support this property or method (in older versions of Internet Explorer)
Run Code Online (Sandbox Code Playgroud)
解:
确保在页面中不多次包含jQuery.删除对jQuery的任何重复脚本引用.包括所有必需的Kendo JavaScript文件.
jQuery不可用或未定义:
如果未包含jQuery,或者包含在Kendo UI JavaScript文件之后,或者包含在Kendo UI小部件初始化语句之后,则Kendo UI小部件将无法按预期运行.将抛出以下JavaScript错误(取决于浏览器):
ReferenceError: jQuery is not defined (in Google Chrome and Firefox)
'jQuery' is undefined (in Internet Explorer)
Run Code Online (Sandbox Code Playgroud)
解:
确保仅在Kendo UI JavaScript文件之前和依赖于它的任何Javascript语句之前包含jQuery.
小智 3
确保您的脚本位于标签内<head>...</head>
<script src="kendo/js/jquery.min.js"> </script>
Run Code Online (Sandbox Code Playgroud)
例子
<head>
<title>......</title>
<script src="kendo/js/jquery.min.js"> </script>
// and then your other script
</head>
Run Code Online (Sandbox Code Playgroud)
希望有用
| 归档时间: |
|
| 查看次数: |
17245 次 |
| 最近记录: |