Recently, when the datagrid data needs to be loaded by form, the total number of footers in the footer is displayed based on the specific item. The datagrid data is not loaded during page initialization, after initialization, you need to read the project values in form and then load the corresponding data
In the datagrid, the error code is as follows:
$ ('# Grid'). datagrid ({
ShowFooter: true
});
$ ('# Form'). form ({
OnLoadSuccess: function (data ){
// Datagrid
$ ('# Grid'). datagrid ({
Url: '/grid/getData? Id = '+ $ (' # id'). val () + '& r =' + Math. random ()
});
}
});
If the datagrid does not display the footer, the column data can be displayed normally. The cause of the problem is that the error is caused by no data when the page is created. The message "rows" in firefox is undefined, of course, is undefined, because I didn't assign a value to the datagrid at all, so the footer of the datagrid won't be displayed. How can I modify it, refer to my previous article [original] EasyUI's DataGrid composite footer and use the tutorial to find a solution. Then, an empty dataset is provided to the datagrid during initialization, let it initialize smoothly, and then replace its data after the form is loaded successfully. The Code is as follows:
Var nullData = '{"rows": [], "total": 0; "footer": {"Footer": "total", "num": 0 }}';
Var json = eval ('+ nullData + ')');
$ ('# Grid'). datagrid ({
Data: json,
ShowFooter: true
});
$ ('# Form'). form ({
OnLoadSuccess: function (data ){
// Datagrid
$ ('# Grid'). datagrid ({
Url: '/grid/getData? Id = '+ $ (' # id'). val () + '& r =' + Math. random ()
});
}
});