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. Image for the cookie policy date

Summary format


Question is related to this sample: https://www.syncfusion.com/kb/4107/how-to-bind-timespan-value-to-grid-column

If Summary is added for  Worked Hours column, how it can be formatted to keep time format? It will show sum as decimal but I need to convert in into time like 12:23:00.


1 Reply

RU Ragavee U S Syncfusion Team January 20, 2016 06:12 AM UTC

Hi Mika,

Since WorkedHours column is a complex object using summary will provide incorrect result and so we can use custom summary option to show correct values. Please refer the below code example.


         . . . .

                .SummaryRow(row => {

                    row.SummaryColumns(col => {




<script type="text/javascript">

          function TimeSpanCounter(summary, data) {

            data = ej.select(data, ["WorkedHours"]);

            //Helper to calulate the total time

            var getter = function (prop, divisor, prev) {

                var f = ej.select(data, [prop]), sum = 0 + (prev || 0);

                sum += ej.sum(f);

                if (prop == "Hours")

                    return sum;

                return {

                    prev: ~~(sum / divisor),

                    org: sum % divisor



            var sec = getter("Seconds", 60), min = getter("Minutes", 60, sec.prev), hours = getter("Hours");

            return this.formatting(summary.format, hours) + " : " + this.formatting(summary.format, min.org) + " : " + this.formatting(summary.format, sec.org);



The formatting of the result is done with the formatting method of the Grid. The custom summary method will be provided with two arguments i.e., summary details and the current view data of the grid.

For your convenience, we have created a sample with the above solution, which can be downloaded from the below location.

Sample Link: http://www.syncfusion.com/downloads/support/forum/121721/ze/Sample1193677306

Ragavee U S.

Live Chat Icon For mobile
Up arrow icon