ExtJS Gridpanel in the case of paging, the service-side statistics Total implementation mode

Source: Internet
Author: User

1, the application scenario in the time when there are pagination calculation totals can not be used ExtJS Gridpanel provide the ftype:summary way to solve, otherwise only calculate the current page of the total (because the data only extracts the current page); 2, Workaround rewrite the Generatesummarydata function in Ext.grid.feature.Summary//method One, temporarily rewrite Ext.grid.feature.Summary.override ({    Generatesummarydata:function () {       return this.view.store.getProxy (). reader.rawdata[ this.remoteroot];   });//Method Two, which defines class overrides so that other modules reference (requires) ext.define (' Ux.override.grid.feature.Summary ', {    override: ' Ext.grid.feature.Summary ',   generatesummarydata:function () {       return this.view.store.getProxy () .reader.rawdata[this.remoteroot];   }); 3, grid configuration features: [{ Ftype: ' Summary ', Remoteroot: ' Summary '//background provides path to data}]4, column configuration {   text: "Pipeline name", Dataindex: "GXMC", width:120 ,       summaryrenderer:function (value, Summarydata, dataindex) {           return ' (' + value + ' entries) Total: ';       }},{text: ' Budget (million) ', Dataindex: ' Yxje ', Width:120,summaryre NDerer:rendernum (value) {if (value) {return Ext.util.Format.number (value, ' 0.#### ');} Return ';}} 5, the background to provide data format, in the original data format added, the path can be customized, with this remoteroot: ' Summary '//background to provide the path of data "summary": {    "Yxje": 80114.5575,     "GXMC": 1081 }  after sense: Ext.grid.feature.Summary This class does not have remoteroot configuration items in the API, but by looking at the ExtJS source, Found that this configuration item has been implemented, but did not implement the Generatesummarydata method, in fact, ExtJS this service-side statistics have been almost finished, but the last small step, so everyone in the learning ExtJS time or need to understand the source code implementation of the;  Remark: Under the Extjs5.1 test pass, thank you.

ExtJS Gridpanel Server-side statistics total implementation in the case of paging

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.