ExtJs on IE 6/8 strange behavior : 'locked' is null
I have developed a page with ExtJS. It works in FF, Chrome and Opera but not in IE.
In IE I have this message :
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windo开发者_C百科ws NT 5.1; Trident/4.0) Timestamp: Mon, 20 Jun 2011 15:51:23 UTC
Message: 'locked' is null or not an object Line: 14364 Char: 13 Code: 0 URI: http://192.168.240.129/lib/ext4/ext-all-debug.js
Message: Exception thrown and not caught Line: 25281 Char: 9 Code: 0 URI: http://192.168.240.129/lib/ext4/ext-all-debug.js
I don't know why it refers to 'locked'. I don't have a locked variable or other in my page.
Thanks if you have some idea or answer.
Some source code of yours of where it is failing would really be helpful.
But here's what I do to figure out what's going on. Use firebug's stack trace to follow which component in your code is failing. You will want to pay close attention to the DOM ID's.
You can also start by commenting out suspicious panels. Once you've identified the panel with the problems, you can narrow down the issue to the exact component that is failing.
As for your question as to what "locked" is, you can refer to the API to see what classes have some sort of locking. Just off the top of my head I can think of a few such as CheckBoxSelection Model.
When working with ExtJs in IE you need to consider that the IE's JSON parser is a lot stricter than that of Chrome or FF. Consider this JSON for instance:
var Model = {
property1: '1',
property2: '2',
property3: '3',
property4: '4',
property5: '5',
}
It is perfectly valid for all mayor Browses so you will not get any error when using it, however notice the last coma on the last element, there is where the problem with IE begins. If you get the length of such object on Chrome/FF the value will be 5, while in IE it will be 6. This means that the parser in IE considers a 6th null element that is after the last coma. This is what is breaking your ExtJs.
A great way to clean up code to avoid the the extra commas is to validate your code using http://www.jslint.com/
精彩评论