Easyui DataGrid with length JS error

Source: Internet
Author: User

Tag: Easyui DataGrid length



Often see the page with the DataGrid control the length of the JS error "' Length ' is empty or not an object", find half-day and can not find the reason, hard to see is not the DataGrid JS configuration problems, the results found that the change is useless.


Deleted the initialization of the DataGrid JS, and really did not appear this JS problem, the problem is concentrated in the DataGrid,



So, turn on JS debugging

See

var _717=["<table class=\" datagrid-btable\ "cellspacing=\" 0\ "cellpadding=\" 0\ "border=\" 0\ "><tbody>"];
for (Var i=0;i<rows.length;i++) {
var css=opts.rowstyler?opts.rowstyler.call (_712,i,rows[i]): "";
var _718= "";
var _719= "";
if (typeof css== "string") {
_719=css;
}else{
if (CSS) {
_718=css["Class"]| | "";
_719=css["Style"]| | "";
}
}

The culprit is this rows.length.



Open the watch, look at rows, find no definition.



Look up and find out how the rows are defined.



Then look at what _715.data is like,


There's only one total, and it's Nan,


See this total and rows, think of, to the code to the DataGrid to set total and rows, recall that no data was found before the time is not set these two things,


After setting these 2 parameters, it is OK to work together. The world is quiet.


Easyui DataGrid with length JS error

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.