1. #1
    Sencha User
    Join Date
    Apr 2013
    Posts
    13
    Vote Rating
    0
    grief89 is on a distinguished road

      0  

    Default Use difference groupSummary and Summary in grid.Panel

    Use difference groupSummary and Summary in grid.Panel


    Hello!

    I am using grid.Panel with Feature summary and groupSummary. How I may use, for example, in group summaryType="count" and in total summary - "sum"?

    Or, How I may identified in method "summaryRenderer" that this is group or total summary?

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,079
    Vote Rating
    186
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    You won't be able to have both a groupingSummary and Summary feature on the same grid with different summaryRenderers as each feature looks to the same config on the column.
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

    C
    heck out all of the 2013 SenchaCon presentations here:
    http://www.sencha.com/blog/senchacon...now-available/

  3. #3
    Sencha User
    Join Date
    Apr 2013
    Posts
    13
    Vote Rating
    0
    grief89 is on a distinguished road

      0  

    Default


    May be I can identify in summaryRenderers that it is group or total?

  4. #4
    Sencha Premium Member
    Join Date
    Feb 2011
    Location
    Amsterdam
    Posts
    52
    Vote Rating
    -3
    sblommers is infamous around these parts

      0  

    Default


    Since AbstractSummary is used as Mixin and is Extended i override the Summary feature and next to isSummary i add isSummaryFeatureSummary like this:

    Code:
    Ext.override(Ext.grid.feature.Summary, {
        createSummaryRecord: function(view) {
            var columns = view.headerCt.getVisibleGridColumns(),
                info = {
                    records: view.store.getRange()
                },
                colCount = columns.length, i, column,
                summaryRecord = this.summaryRecord || (this.summaryRecord = new view.store.model(null, view.id + '-summary-record'));
    
    
            // Set the summary field values
            summaryRecord.beginEdit();
            for (i = 0; i < colCount; i++) {
                column = columns[i];
    
    
                // In summary records, if there's no dataIndex, then the value in regular rows must come from a renderer.
                // We set the data value in using the column ID.
                if (!column.dataIndex) {
                    column.dataIndex = column.id;
                }
    
    
                summaryRecord.set(column.dataIndex, this.getSummary(view.store, column.summaryType, column.dataIndex, info));
            }
            summaryRecord.endEdit(true);
            // It's not dirty
            summaryRecord.commit(true);
            summaryRecord.isSummary = true;
            summaryRecord.isSummaryFeatureSummary = true;
    
    
            return summaryRecord;
        }
    });
    Then in summaryRenderers i check the record as follows:

    Code:
    summaryRenderer = function(value, data, record) {
        if(record.isSummaryFeatureSummary)
            return '<b>Grand Total</b>';
        
        // Return group summary
        return '<b>'+value+'</b>';
    };
    Maybe it's helpful, solved my case.

    Be sure if you return other columns through your summaryRenderers that you have a summaryType returning a value specified for that column configuration.

    If you need more code to get GroupingSummary and Summary features working together let me know.
    Last edited by sblommers; 5 Aug 2013 at 12:37 PM. Reason: fat letters for lazy eyes ;-)

  5. #5
    Sencha User
    Join Date
    Nov 2008
    Posts
    2
    Vote Rating
    0
    sygonia is on a distinguished road

      0  

    Default HOW TO COMPUTE OVERTALL TOTAL VALUES IN A GROUPING SUMMARY OF GRIDPANEL

    HOW TO COMPUTE OVERTALL TOTAL VALUES IN A GROUPING SUMMARY OF GRIDPANEL


    Hi, I'm new to extjs. I need your favorable from an expert extjs guy who could help me on how to compute for the overall total values in a column of groupingsummary using ext.grid.panel.

    The way i solved this was to use ext.toolbar by adding textfield and sum the overall total in a column and place the result in the textfield. But I wonder to add the resullt at the last row of the grid.panel. Please take note that this an ftype groupingsummary not a summary as ftype summary does the overall total.

    Thanks much for the favorable action taken.

    Solomon