Precautions for using the datagrid footer in EasyUI

Source: Internet
Author: User

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 ()
});
}
});

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.