The DataGrid space can request JSON data asynchronously and overwrite the new data with the original data and redraw the data table.
But when it comes back to the empty data set, JS generates an error like this:
NULL for (var i=0;i<rows.length;i++) { ^
What is the problem?
The content returned when you can see the empty data set is:
{"Total": "0", "Rows":null}
Note that the value for rows is null, and a collection is required to ensure that JS is not faulted, that is, the empty set [].
Workaround:
If you ignore the JS error, only need to render the correct results on the page, you can refresh the data set, manually clear the data, so that the timely return of NULL causes JS error stop, the page renders an empty dataset is also correct.
$ (' #grid '). DataGrid (' LoadData ', {total:0, rows: []});
If it is elegant, let the backend (for example, PHP) return the empty set is not NULL, but [], the same can solve the problem:
if ($result[' Total ']==0) { echo ' {"All": "0", "Rows": []} '; return ;}
Or
if ($result[' rows ']===null) $result=array(); echo json_encode ($result);
Workaround for the DataGrid empty DataSet not refreshed in Easyui