0

我是 jqGrid 的新手,我刚开始在 jqGrid 上用 asp.net 网络表单做示例。我将数组方法用于示例目的,没有任何额外的功能。现在我正在尝试将寻呼机功能添加到 jqGrid。在添加寻呼机功能时,我收到以下错误。

Microsoft JScript 运行时错误:无法获取属性“整数”的值:对象为空或未定义

错误出现在插件的以下部分

k=b.jgrid.formatter.integer||{}

我正在为您提供我到目前为止所做的代码片段。

页面

<asp:ScriptManager ID="SmjqGrid" runat="server" >
        <Scripts>
            <asp:ScriptReference Path="~/Scripts/jQuery.1.9.1.min.js" />
            <asp:ScriptReference Path="~/Scripts/jquery-ui-1.8.2.custom.min.js"  />
            <%--<asp:ScriptReference Path="~/Scripts/grid.locale-en.js" />--%>
            <asp:ScriptReference Path="~/Scripts/jquery.jqGrid.min.js" />
            <asp:ScriptReference Path="~/Scripts/ui.multiselect.js"  />
        </Scripts>
    </asp:ScriptManager>
    <script type="text/javascript">
        function pageLoad() {
            jQuery("#list4").jqGrid({
                datatype: "local",
                height: 250,
                colNames: [ 'Date', 'Client', 'Amount', 'Tax', 'Total'],
                colModel: [
        { name: 'invdate', index: 'invdate', width: 90, sorttype: "date" },
        { name: 'name', index: 'name', width: 100 },
        { name: 'amount', index: 'amount', width: 80, align: "right", sorttype: "float" },
        { name: 'tax', index: 'tax', width: 80, align: "right", sorttype: "float" },
        { name: 'total', index: 'total', width: 80, align: "right", sorttype: "float" }
    ],
                multiselect: true,
                caption: "Sample On jqGrid",
                rowNum: 5,
                pager: '#pager'
            });
            var mydata = [
        { id: "1", invdate: "2007-10-01", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" },
        { id: "2", invdate: "2007-10-02", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" },
        { id: "3", invdate: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00" },
        { id: "4", invdate: "2007-10-04", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" },
        { id: "5", invdate: "2007-10-05", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" },
        { id: "6", invdate: "2007-09-06", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00" },
        { id: "7", invdate: "2007-10-04", name: "test", note: "note", amount: "200.00", tax: "10.00", total: "210.00" },
        { id: "8", invdate: "2007-10-03", name: "test2", note: "note2", amount: "300.00", tax: "20.00", total: "320.00" },
        { id: "9", invdate: "2007-09-01", name: "test3", note: "note3", amount: "400.00", tax: "30.00", total: "430.00" }
        ];
            for (var i = 0; i <= mydata.length; i++) {
                jQuery("#list4").jqGrid('addRowData', i + 1, mydata[i]);
            }
        }
    </script>
    <table id="list4"></table>
    <div id="pager"></div>

希望我的问题足够清楚。

4

2 回答 2

4

您应该包括grid.locale-en.js(您在代码中注释了相应的行)。之前需要包含它jquery.jqGrid.min.js(请参阅文档

于 2013-05-23T05:02:03.100 回答
0

这是一个老问题,但我知道人们仍在使用 jqGrid :)

所以,我在网上找到的没有任何帮助。唯一有帮助的事情,我找不到任何原因,是这个错误没有发生,只有在使用缩小的 jqGrid 脚本时寻呼机才能正常工作......(意味着用 jqgrid.min 替换 jqgrid.src.js .js)。我不知道它为什么会有所帮助——可能是因为我目前正在处理的页面正在运行大约 20 个不同的脚本,所以可能存在某种冲突问题。

于 2016-01-25T20:19:23.400 回答