JQuery Easyui IE browser appears ' Rowspan ' is empty or not an object

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.