对象不支持属性或方法“jtable”

Object doesn't support property or method 'jtable'

本文关键字:jtable 方法 不支持 属性 对象      更新时间:2023-09-26

我正在尝试按照这个 http://www.jtable.org/GettingStarted 教程在MVC 4默认项目(Visual studio 2013)中测试jTable。但是,我在下一行不断收到以下错误

$('#PersonTable').jtable({

错误如下

JavaScript 运行时错误:对象不支持属性或方法 "叽叽喳喳"

下面是我的.cshtml视图文件。

@{
   ViewBag.Title = "GatePassTypeList";
}
<html>
<head>
    <script src="@Url.Content("~/Scripts/jquery-2.1.3.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.11.2.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jtable/jquery.jtable.min.js")" type="text/javascript"></script>
    <link href=@Url.Content("~/Scripts/jtable/themes/metro/blue/jtable.min.css") rel="stylesheet" type="text/css" />
    ><meta name="viewport" content="width=device-width" />
    <title>GatePassTypeList</title>
</head>
<body>
    <div id="PersonTable" style="width: 580px; margin: auto;"></div>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#PersonTable').jtable({
                title: 'Table of people',
                actions: {
                    listAction: '/GatePassType/GetGatePassTypeList',
                    createAction: '/GatePassType/CreateGatePassType',
                    updateAction: '/GatePassType/UpdateGatePassType',
                    deleteAction: '/GatePassType/DeleteGatePassType',
                },
                fields: {
                    PersonId: {
                        key: true,
                        list: false
                    },
                    Name: {
                        title: 'Author Name',
                        width: '40%'
                    },
                    Age: {
                        title: 'Age',
                        width: '20%'
                    },
                    RecordDate: {
                        title: 'Record date',
                        width: '30%',
                        type: 'date',
                        create: false,
                        edit: false
                    }
                }
            });
        });
    </script>
</body>
</html>
确保正确

加载.js脚本。(使用 F12 浏览器检查器)。
(这句话对吗? : ><meta name="viewport" content="width=device-width" />

不要忘记这一点:

$('#PersonTable').jtable('load');

加载表。