未捕获的ReferenceError:使用Kendo网格时未定义jQuery

时间:2014-11-28 02:51:12

标签: javascript jquery asp.net-mvc-5 kendo-grid

我使用剑道网格。我开始,它显示错误: 1)不在网格中显示数据 i822.photobucket.com/albums/zz149/luongnam230892/loi1.png

1)我使用F12 show console并显示错误:“Uncaught ReferenceError:jQuery未定义” i822.photobucket.com/albums/zz149/luongnam230892/loi2.png

2)我点击它:

enter code here

jQuery(function(){jQuery("#griddata").kendoGrid({"edit":onEdit,"columns":[{"title":"Ma Chuc Vu","field":"MaChucVu","filterable":{},"encoded":true},{"title":"Chuc Vu","field":"ChucVu","filterable":{},"encoded":true,"editor":"\u003cinput class=\"text-box single-line\" data-val=\"true\" data-val-length=\"The field ChucVu must be a string with a maximum length of 50.\" data-val-length-max=\"50\" data-val-required=\"The ChucVu field is required.\" id=\"ChucVu\" name=\"ChucVu\" type=\"text\" value=\"\" /\u003e\u003cspan class=\"field-validation-valid\" data-valmsg-for=\"ChucVu\" data-valmsg-replace=\"true\"\u003e\u003c/span\u003e"},{"title":"Ghi Chu","field":"GhiChu","filterable":{},"encoded":true,"editor":"\u003cinput class=\"text-box single-line\" data-val=\"true\" data-val-length=\"The field GhiChu must be a string with a maximum length of 50.\" data-val-length-max=\"50\" id=\"GhiChu\" name=\"GhiChu\" type=\"text\" value=\"\" /\u003e\u003cspan class=\"field-validation-valid\" data-valmsg-for=\"GhiChu\" data-valmsg-replace=\"true\"\u003e\u003c/span\u003e"},{"title":"Chức năng","command":[{"name":"edit","buttonType":"ImageAndText","text":{"cancel":"Hủy","update":"Cập nhật","edit":"Sửa"}},{"name":"destroy","buttonType":"ImageAndText","text":"Xóa"}]}],"pageable":{"input":true,"refresh":true,"buttonCount":7,"messages":{"display":"{0}-{1} của {2} bản ghi.","empty":"Không có dữ liệu","page":"Trang","of":"của {0}","first":"Trang đầu tiên","previous":"Trang trước","next":"Trang tiếp","last":"Trang cuối cùng","refresh":"Làm mới"}},"sortable":true,"filterable":{"extra":false,"messages":{"info":"Điều kiện lọc tìm kiếm","filter":"Lọc","clear":"Xóa","and":"Và"},"operators":{"string":{"startswith":"Bắt đầu với","eq":"Đúng bằng","neq":"Không bao gồm","contains":"Chứa ký tự"},"number":{"gt":"Lớn hơn","eq":"Bằng","neq":"Nhỏ hơn"}}},"scrollable":false,"editable":{"confirmation":"Bạn có muốn xóa?","confirmDelete":"Bạn có muốn xóa?","cancelDelete":"Cancel","mode":"inline","create":true,"update":true,"destroy":true},"toolbar":{},"dataSource":{"type":(function(){if(kendo.data.transports['aspnetmvc-ajax']){return 'aspnetmvc-ajax';} else{throw new Error('The kendo.aspnetmvc.min.js script is not included.');}})(),"transport":{"read":{"url":"/QLDanhMuc/HienThiChucVu"},"prefix":"","update":{"url":"/QLDanhMuc/SuaChucVu"},"create":{"url":"/QLDanhMuc/TaoChucVu"},"destroy":{"url":"/QLDanhMuc/XoaChucVu"}},"pageSize":8,"page":1,"total":0,"sort":[{"field":"MaChucVu","dir":"desc"}],"error":onError,"requestEnd":onRequestEnd,"schema":{"data":"Data","total":"Total","errors":"Errors","model":{"id":"MaChucVu","fields":{"MaChucVu":{"editable":false,"type":"number"},"ChucVu":{"type":"string"},"GhiChu":{"type":"string"},"tbl_TacGias":{"type":"object"}}}}}});});    `enter code here`

3)我尝试搜索谷歌并修复但失败了。 在控制器中:

enter code here
public ActionResult ChucVu()
    {
        //Database.SetInitializer<QLGTContext>(null);
        if (!Request.IsAjaxRequest())
            return View();
        return PartialView();
    }
public ActionResult HienThiChucVu()
    {
        //return Json(db.tbl_ChucVus.ToDataSourceResult(request));
        return Json(db.tbl_ChucVus, JsonRequestBehavior.AllowGet);
    }    `enter code here`

我尝试使用“返回Json(db.tbl_ChucVus.ToDataSourceResult(request))”但不显示数据,然后单击按钮刷新网格然后显示错误: http://i822.photobucket.com/albums/zz149/luongnam230892/loi3.png

在我尝试使用“返回Json(db.tbl_ChucVus,JsonRequestBehavior.AllowGet)”并且也没有显示数据之后,我点击按钮刷新然后显示数据: http://i822.photobucket.com/albums/zz149/luongnam230892/dulieu.png

我使用Jquery

enter code here

<script src="~/Scripts/jquery.min.js"></script>
<script src="~/Scripts/jquery-migrate.min.js"></script>
<script src="~/Scripts/jquery-ui-1.10.3.custom.min.js"></script>
<script src="~/Scripts/bootstrap.min.js"></script>
<script src="~/scripts/bootstrap-hover-dropdown.min.js"></script>
<script src="~/Scripts/jquery.slimscroll.min.js"></script>
<script src="~/Scripts/jquery.blockui.min.js"></script>
<script src="~/Scripts/jquery.uniform.min.js"></script>
<script src="~/Scripts/bootstrap-switch.min.js"></script>
<script src="~/Scripts/metronic.js"></script>
<script src="~/Scripts/layout.js"></script>
<script src="~/Scripts/quick-sidebar.js"></script>
<script src="~/Scripts/kendo.all.min.js"></script>
<script src="~/Scripts/kendo.aspnetmvc.min.js"></script>
<script src="~/scripts/kendo.culture.vi.min.js"></script>
<script src="~/scripts/jquery.sparkline.min.js"></script>
enter code here

我尝试添加一些Jquery但不显示

enter code here

<script src="~/Scripts/kendo.timezones.min.js"></script>
<script src="~/Scripts/kendo-dojo.js"></script>
<script src="~/Scripts/prettify.js"></script>
<script src="~/Scripts/console.js"></script>
<script src="~/Scripts/modernizr-2.8.3.js"></script>
<script src="~/Scripts/knockout-3.2.0.js"></script>
<script src="~/Scripts/jquery-2.1.1.min.js"></script>
<script src="~/Scripts/jquery-ui-1.11.2.min.js"></script>
<script src="~/Scripts/jquery-2.1.1.intellisense.js"></script>
<script src="~/Scripts/jquery-2.1.1.js"></script>
<script src="~/Scripts/jquery-ui-1.11.2.js"></script>
<script src="~/Scripts/jquery.blockui.min.js"></script>
<script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
<script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
enter code here

请!帮我! 谢谢!

1 个答案:

答案 0 :(得分:0)

jquery 必须不是所有jquery库的顶部。