Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8670719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:46:27+00:00 2026-06-12T18:46:27+00:00

I am using the Extjs4 multigrouping plugin from here . I have used it

  • 0

I am using the Extjs4 multigrouping plugin from here.

I have used it successfully, however i want to show the summary of the totals of each column within the group header itself . how do i set up the appropriate CSS for that ?

Sum of Columns under respective columns in grouped header

In Multigrouping.js

getFragmentTpl: function() {
    var me = this;
    return {
        indentByDepth: me.indentByDepth,
        depthToIndent: me.depthToIndent,
        renderGroupHeaderTpl: function(values, parent) {
     return Ext.XTemplate.getTpl(me, 'groupHeaderTpl').apply(values, parent);
            //var z = new Ext.XTemplate('{name} ({rows.grouplength})');
            //return z.apply(values, parent);
        }
    };
},

In my grid

features: [ 
    {
        ftype:'multigrouping',
        groupHeaderTpl: [
                         '{[this.readOut(values)]}',
                         {
                             readOut:function(values) {
                                 debugger;
                                 var sum1 =0 ,sum2=0,sum3=0;
                                    for( var i = 0 ; i< values.records.length ; i++)
                                        {
                                            var val = parseFloat(values.records[i].data.d2012.mp);
                                            sum1 += isNaN(val) ? 0.0 : val;
                                            val = parseFloat(values.records[i].data.d2013.mp);
                                            sum2 += isNaN(val) ? 0.0 : val;
                                            val = parseFloat(values.records[i].data.d2014.mp);
                                            sum3 += isNaN(val) ? 0.0 : val;

                                        }
                                    return values.name +  '(' + values.records.length + ')' +  ' ' + sum1.toFixed(2) + '            ' + sum2.toFixed(2) + '           ' + sum3.toFixed(2);
                                }
                         }
                     ]

    },
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T18:46:28+00:00Added an answer on June 12, 2026 at 6:46 pm

    had to resort to a few hacks to get this to work. still waiting on an official answer.
    The main reason i had to do this and not use the multigrouping summary is because
    – i want to limit the number of records from the server. I can do some smart grouping of
    my business objects at the server side.
    – the main reason to do this is because of IE8’s performance on larger sets of data.
    – had already tried the extjs4 tree grid component which works well on chrome but had performance issues on IE8.

    the hack is to
    a) use an array property in the grid to store the dom elements which i want to manipulate
    b) use a boolean to know when the layout is completed the first time
    b) add listeners for afterlayout ( when your app can do an Ext.get(‘..dom element..’) you know you are done )

    The listener :

    listeners : 
    {
     afterlayout : function(eopts)
     {
         var x = this.mOwnArray;
         if(!this.loadedwithVals && x.length > 0)
             {
        for(var i =0 ; i<x.length ; i++)
            {
                var dom = Ext.get(x[i].id);
                var theId = dom.id;
                theId = theId.match(/\d+/)[0];
                var title = dom.query("td[class='x-grid-cell x-grid-cell-first']");
                title[0].className = 'x-grid-cell x-grid-cell-gridcolumn-' + theId + ' x-grid-cell-first';
                title[0].colSpan=1;
                var groupedHeader = dom.query("div[class='x-grid-group-title']");
                groupedHeader[0].innerHTML =  x[i].name + '(' + x[i].length + ')';
                for(var year=2012;year<=2018;year++)
                    {
                    var t = "t"+year;
                    var someText1 = '<td class=" x-grid-cell x-grid-cell-numbercolumn">';
                    var someText2 = '<div class="x-grid-cell-inner " style="text-align: left; ;">';
                    var someText3 = '<div class="x-grid-group-title">' + x[i].total[t] + '</div></div></td>';
                    var someText = someText1 + someText2 + someText3;
                    dom.insertHtml("beforeEnd",someText);   
                    }
            }
                this.loadedwithVals = true;
         }
    }
    

    And the feature as in

    features: [ 
        {
            ftype:'multigrouping',
            startCollapsed : true,
            groupHeaderTpl: [
                             '{[this.readOut(values)]}',
                             {
                                 readOut:function(values) {
                                     var header = new Object();
                                     header.id = values.groupHeaderId;
                                     header.sum = [];
                                     header.total = new Object();
                                     for(var year = 2012 ; year <= 2018 ; year++)
                                         {
                                            var t = "t"+year;
                                            header.total[t] = [];
                                         }
                                     // all the records in this header
                                        for( var i = 0 ; i< values.records.length ; i++)
                                            {
                                                // for all the 'years' in this record
                                                for(var year=2012;year<=2018;year++)
                                                    {
                                                        var d = "d"+year;
                                                        var ct = "t" + year;
                                                        var arecord = values.records[i].data;
                                                        var val = parseFloat(arecord[d].mp);
                                                        val = isNaN(val) ? 0.0 : val;
                                                        Ext.Array.push(header.total[ct],val);
                                                    }
                                            }
                                    // push the sum of the records into its top level group
                                             for(var year = 2012 ; year <= 2018 ; year++)
                                             {
                                                var t = "t"+year;
                                                var sum = Ext.Array.sum(header.total[t]);
                                                header.total[t] = sum.toFixed(2);
                                             }
                                     header.name = values.name;
                                     header.length = values.records.length;
                                     var headerName = values.name;
                                     if(values.hasOwnProperty('parent'))
                                         {
                                            var parent = values.parent;
                                            headerName = headerName.replace(parent,'');
                                         }
                                     header.name = headerName;
                                     header.length = values.records.length;
                                     Ext.Array.push(grid.mOwnArray,header);
                                     // really not used
                                    return values.name +  '(' + values.records.length + ')';
                                    }
                             }
                         ]
    
        },
    ]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using ExtJS 2.2.1 In my web app, I used to have a TreePanel
I am using ExtJS 3 here. I would like to populate a formpanel from
im using extjs4 with dwr3 to upload a file this is all i have
I am using ExtJs4.I have a form in my web application in which there
I am using EXTJS4. I have a tree which displays classes (classname) on one
I have developed a web application using ExtJs4.0.7. The application is working fine in
I want to remove a Storeitem in ExtJS4.1 using store.remove(item) , but i don't
I have an extjs4 panel created using this config object. { title : 'Messages',
I am using Extjs4.1.0. I have a grid with an actioncolumn. I have to
I want to create TreePanel using ExtJS4. So I'm sending JSON to proxy reader

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.