【问题标题】:jqGrid Issue when trying to use pager尝试使用寻呼机时出现 jqGrid 问题
【发布时间】:2013-05-23 04:43:45
【问题描述】:

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

Microsoft JScript 运行时错误:无法获取属性值 'integer': 对象为空或未定义

插件的以下部分出现错误

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

我给你提供了我到目前为止所做的代码sn-p。

Aspx 页面

<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>

希望我的问题足够清楚。

【问题讨论】:

    标签: jquery asp.net jqgrid


    【解决方案1】:

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

    【讨论】:

    • Oleg,你能告诉我为什么我们需要包含语言环境文件
    • @Rohith:如果您检查文件grid.locale-XX.js,您可以回答自己的问题。整数 1000 在不同国家可以显示为1,0001.0001 000。因此,将信息定义在单独的文件中。有些产品在主 JavaScript 文件中包含 EN-US 信息,但您需要通过在主 JavaScript 文件之后包含语言文件来替换语言特定信息。 jqGrid 遵循另一个规则:它不包含任何特定于语言的信息。因此,您必须始终包含 两个 文件:一些 grid.locale-XX.js,然后是 jquery.jqGrid.min.js
    【解决方案2】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-07
      • 2011-06-13
      • 2011-04-17
      相关资源
      最近更新 更多