jqGrid引发:未捕获的TypeError:无法读取未定义的属性'a' [英] jqGrid throws: Uncaught TypeError: Cannot read property 'a' of undefined
问题描述
我在SO上发现了其他几个基于Uncaught TypeError
的问题,但没有找到这个特定问题,所以我认为我会提出这个问题,以防其他人遇到这个问题.
I found several other Uncaught TypeError
based questions on SO but not this particular one, so I thought I'll put this up just in case anyone else has had this issue.
我的jqGrid可以正常工作,但是我仍然在控制台中看到此错误:
My jqGrid works absolutely fine however I keep seeing this error in the console:
Uncaught TypeError: Cannot read property 'a' of undefined jquery.jqGrid.min.js:423
我检查了一下,这对应于 jquery.jqGrid.src.js
I checked and this corresponds to line 4364 of jquery.jqGrid.src.js
我使用的版本是 jqGrid-4.4.0
在网格加载后,但在网格填充数据之前,我得到了错误.
I get the error as soon as the grid loads, but before the grid is populated with data.
我很担心,尽管它起作用了,因为我的大多数用户都在IE6上使用,即使有时出现最严重的javascript错误,IE也非常糟糕. 在此问题上提供的任何帮助将不胜感激.
I'm concerned even though it works because most of my users are on IE6 and IE is very anal even about the silliest of javascript errors at times. Any sort of help on this issue will be greatly appreciated.
PS:我想在阅读了类似的先前问过的问题后会添加几件事.
PS: A couple of things I thought I'll add after reading responses to similar previously asked questions.
- 我已经设置了
root: "rows"
- 我已经设置了
jsonReader : { repeatitems: false }
- 我返回到网格的JSON数据具有以下结构:
{"total": "1", "records": "0", "rows": [], "page": "1"}
- 我还尝试了最新版本的jqGrid-4.4.1.仍然会出现相同的错误.
- I've already set
root: "rows"
- I've already set
jsonReader : { repeatitems: false }
- The JSON data I'm returning to the grid is of the structure:
{"total": "1", "records": "0", "rows": [], "page": "1"}
- I also just tried jqGrid-4.4.1 which is the latest version. Still get the same error.
推荐答案
这很奇怪!
jQuery 4.4.0
的jquery.jqGrid.src.js
的4364行位于jqGrid的jqModal
模块内部,这实际上并不是必需的.网格加载期间通常不应使用该模块.在许多情况下,将jqModal
参数设置为false可能无法使用它.
The line 4364 of jquery.jqGrid.src.js
of jQuery 4.4.0
is inside of jqModal
module of jqGrid which is mostly not really required. The module should typically not used during loading of the grid. In many cases it could be not used by setting jqModal
parameter to false.
我想您与使用的其他JavaScript插件存在一些兼容性问题.
I suppose that you have some compatibility problems with other JavaScript plugins which you use.
您可以在代码开头的某个位置将$.fn.jqm
设置为undefined
或null
.例如,您可以在加载jquery.jqGrid.src.js
或jquery.jqGrid.min.js
之后直接执行此操作.结果将不使用模块jqModal
.
You can set $.fn.jqm
to undefined
or null
in your code somewhere at the beginning of your code. For example you can do this directly after loading of jquery.jqGrid.src.js
or jquery.jqGrid.min.js
. As the results the module jqModal
will be not used.
这篇关于jqGrid引发:未捕获的TypeError:无法读取未定义的属性'a'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!