本文介绍了获取0x800a01b6-JavaScript运行时错误:对象不支持属性或方法'jqGrid'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的代码:

<script type="text/javascript">
  $("#Employee-grid-array").jqGrid({
                datatype: "xml",
                mtype: 'json',
                rowNum: 1,
                url:'/DebitCredit/Index',
                rowList: [1, 2, 4, 5, 10],
                colNames: ['Account', 'Tranaction No', 'Transaction Date', 'Status', 'Landfill Site', 'Transaction Amount', 'Vat Amount', 'Weight', 'Remarks'
                 , 'Created by', 'Created Date'],
                colModel: [
                      { name: 'Account_No', index: 'Account_No', width: 100,  editable: true },
                      { name: 'Tran_No', index: 'Tran_No', width: 100,  editable: true },
                      { name: 'Tran_Date', index: 'Tran_Date', width: 150,  editable: true },
                      { name: 'Status_QC', index: 'Status_QC', width: 50  },
                      { name: 'Landfill_Site_ID', index: 'Landfill_Site_ID', width: 100,  editable: true },
                      { name: 'Tran_Amount', index: 'Tran_Amount', width: 100,  editable: true },
                      { name: 'Vat_Amount', index: 'Vat_Amount', width: 100,  editable: true },
                      { name: 'Weight', index: 'Weight', width: 70,  editable: true },
                      { name: 'Remarks', index: 'Remarks', width: 70,  editable: true },
                      { name: 'Created_By', index: 'Created_By', width: 100  },
                       { name: 'Created_Date', index: 'Created_Date', width: 100  },
                ],
                pager: jQuery('#pagernav'),
                multiselect: true,
                viewrecords: true,
                shrinkToFit: false
            }).navGrid('#pagernav', { edit: true, add: true, del: true },
        // Edit options
            {
                savekey: [true, 13],
                reloadAfterSubmit: true,
                jqModal: false,
                closeOnEscape: true,
                closeAfterEdit: true,
                url: "/DebitCredit/Edit",
                closeAfterSubmit: true,
                afterSubmit: function () {
                    $("#Employee-grid-array").jqGrid('setGridParam', { datatype: 'json' }).trigger('reloadGrid')
                }
            },
        // Add options
             {
                 url: '/DebitCredit/Create', closeAfterAdd: true, reloadAfterSubmit: true
             },
        // Delete options
               {
                   url: '/DebitCredit/Remove',
                   jqModal: false,
                   serializeDelData: function (postdata) {

                       return { id: postdata.Tran_No,test:"test" }; // the body MUST be empty in DELETE HTTP requests
                   },

                   afterSubmit: function (response, postdata) {
                       var rowdata = $('#Employee-grid-array').getRowData(postdata.Account_No);
                       return { Name: postdata.Tran_No, test: "test" };

                   }
               },
               {

                   closeOnEscape: true, multipleSearch: true,
                   closeAfterSearch: true
               }
               );
</script>

点击后出现以下错误在编辑弹出窗口中提交(在提交"行之后的编辑"选项上)

Getting below error after clickingsubmit in edit popup(on Edit options afterSubmit line)

0x800a01b6-JavaScript运行时错误:对象不支持属性或方法'jqGrid'

0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'jqGrid'

推荐答案

似乎您缺少jquery和/或jquery网格声明.我拿了您的代码,并将其放在您的脚本上方

seems you are missing your jquery and/or jquery grid declarations. I took your code and put this above your script

<link href="//cdn.jsdelivr.net/jqgrid/4.5.2/css/ui.jqgrid.css"></script>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="//cdn.jsdelivr.net/jqgrid/4.5.2/jquery.jqGrid.js"></script>

它并没有引发您的错误-我没有尝试连接任何东西.为了获得最佳做法,建议您将CSS和javascript放在正文底部

and it didn't throw your error -- i didn't try to wire up anything. For best practices, its recommended you put css in and javascript at bottom of body

这篇关于获取0x800a01b6-JavaScript运行时错误:对象不支持属性或方法'jqGrid'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 21:40