We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Summary template

Thread ID:





127651 Nov 30,2016 10:47 AM UTC Dec 8,2016 04:15 AM UTC JavaScript 3
Tags: ejGrid
Egi Žaberl
Asked On November 30, 2016 10:47 AM UTC

Dear all, 
is it possible to template summary based on sum number?
I want to have red summary if number is below 80, orange if between 80 and 100 and green if over 100.
I want style summary cell or to the whole row.

Regards, Egi

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On December 1, 2016 02:55 PM UTC

Hi Egi, 
You can template property of the summaryColumns to format/customize the corresponding summary cells/group summary cells. In the following code example, we have use the jsrender helper functions along the template property to format the Summary cells.  
    <div id="Grid"></div> 
    <script type="text/javascript"> 
        function format(value, proxy) { 
            var val = ej.parseFloat(value); 
            if (val < 80) 
                return '<span style="color: red">' + value + '</span>'; 
            if (val >= 80 && val <= 100) 
                return '<span style="color: orange">' + value + '</span>'; 
            if (val > 100) 
                return '<span style="color: green">' + value + '</span>'; 
        $(function () { 
            var helpers = { formatting: format };//helpers 
                dataSource: window.gridData, 
                allowPaging: true, 
                allowSorting: true, 
                showSummary: true, 
                allowGrouping: true, 
                summaryRows: [ 
                        title: "Sum", 
                        summaryColumns: [{ 
                            summaryType: ej.Grid.SummaryType.Sum, 
                            template: "{{:~formatting(#data['summaryValue'])}}", 
                            displayColumn: "Freight", dataMember: "Freight", 
                            format: "{0:C2}" 
                columns: [ 
                          . ..   
                    { field: "Freight", format: "{0:C}" } 
We have also prepared a sample that can be referred from the following jsPlayground. 
Refer to the following API reference section. 
Seeni Sakthi Kumar S. 

Egi Žaberl
Replied On December 6, 2016 09:16 AM UTC

That is what i want. Thank you for your answer/sample!

Regards, Egi

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On December 8, 2016 04:15 AM UTC

Hi Egi, 
We are happy to hear that your query has been resolved. If you require further assistance on this, please get back to us. 
Seeni Sakthi Kumar S. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon