Environment:
Easyui 1.4.2.
Phenomenon:
When using the DataGrid control with jquery Easyui, you use the way you specify columns dynamically, with the following code:
$ ("#topApList"). DataGrid ({columns:[[
{field: ' AAA ', title: ' AAA ', align: ' center ', width:130},
{field: ' BBB ', title: ' BBB ', align: ' center ', width:100} ,
]]
});
An error occurred while opening the page in the IE8 browser:' Rowspan ' is empty or not an object, ' Colspan ' is empty or not an object.
There are no errors in Firefox, Safari, Chrome, and the page is displayed properly.
Analysis Code:
Jquery.easyui.mini.js code, highlighted in the place where there is a null pointer exception:
for (var j = 0; J < Cols.length; J + +) {
var col = cols[j];
var attr = "";
if (Col.rowspan) {
attr + = "rowspan=\" "+ Col.rowspan +" \ ";
}
if (Col.colspan) {
attr + = "colspan=\" "+ Col.colspan +" \ ";
}
Reason:
After the last field, a comma appears, causing the browser to calculate a cols.length of 3 (with an actual value of 2) and a null pointer exception when accessing COLS[2].
Solution:
Remove the comma after the last field.
Effect:
The above error does not appear in IE.
JQuery Easyui IE browser appears ' Rowspan ' is empty or not an object