TypeError: undefined is not a function in jqGrid

匿名 (未验证) 提交于 2019-12-03 01:36:02

问题:

I am working on jqGrid. I am new to it. I am using data type as 'local'. whenever I used to execute the line jQuery("#list2").jqGrid({...}), I get an error as 'TypeError: undefined is not a function' No other information i am getting with this. The code is as below:

<script src="~/Scripts/jquery-1.7.1.js"></script> <script src="~/Scripts/jquery-ui-1.8.20.js"></script> <script src="~/Scripts/JQGrid/jquery.jqGrid.js"></script> <script src="~/Scripts/JQGrid/jqModal.js"></script> <script src="~/Scripts/JQGrid/jqDnR.js"></script> <script src="~/Scripts/JQGrid/grid.formedit.js"></script> <script src="~/Scripts/JQGrid/grid.common.js"></script> <link href="~/Content/ui.jqgrid.css" rel="stylesheet" />  <table id="list2"></table> <script type="text/javascript"> $(document).ready(function () { 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" }     ];       jQuery("#list2").jqGrid({         datatype: "local",         data: mydata,         colNames: ['Inv No', 'Date', 'Client', 'Amount', 'Tax', 'Total', 'Notes'],         colModel: [             { name: 'id', index: 'id', width: 60, sorttype: "int" },             { 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" },             { name: 'note', index: 'note', width: 150, sortable: false }         ],         rowNum: 10,         rowList: [10, 20, 30],         jsonReader: { repeatitems: false },         //pager: '#pager2',         sortname: 'id',         viewrecords: true,         sortorder: "desc",         caption: "JSON Example"     });      for (var i = 0; i <= _data.length; i++)         jQuery("#list2").jqGrid('addRowData', i + 1, mydata[i]); }); 

The code above is taken from jqGrid official website

Where am going wrong? also, Which datatype should I use local or json and why? I didn't find better and easy to understand description anywhere.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!