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