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

Display Sum of two columns values in another column while Cell Edit in ej grid

Thread ID:





119475 Jun 26,2015 09:53 AM UTC Jul 6,2015 12:45 PM UTC ASP.NET MVC 5
Tags: Grid
Asked On June 26, 2015 09:53 AM UTC

if (args.columnName == "NoofFlats" )
                            var N1 = parseInt(args.value);                          
                        if (args.columnName == "NoofShops")
                            var N12= parseInt(args.value);                            

Sellappandi Ramu [Syncfusion]
Replied On June 29, 2015 11:46 AM UTC

Hi Ganga,

Thanks for using Syncfusion products.

We have created a sample by using column template to display the sum value and it can be downloaded from following link location.

Sample Link: http://www.syncfusion.com/downloads/support/forum/119475/ze/Sample_1194751288504676

In the above sample, we have used jQuery helper function to perform the addition operation and return into template column. When we edit a row, modified records value will be reflected in the template column. Please refer the following code example.

<script type="text/x-jsrender" id="columnTemplate">

    {{>~Addition(First, Second)}}




        .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); })

        … .

        .Columns(col =>


            col.Field("EmployeeID").HeaderText("Employee ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();

            col.Field("EmployeeName").HeaderText("Employee Name").TextAlign(TextAlign.Left).Width(75).Add();

            col.Field("First").HeaderText("First Value").TextAlign(TextAlign.Right).Width(75).Add();

            col.Field("Second").HeaderText("Second Value").TextAlign(TextAlign.Right).Width(75).Add();

            col.HeaderText("Sum Value").Template(true).TemplateID("#columnTemplate").TextAlign(TextAlign.Right).Width(110).Add();




        Addition: function (args1, args2) {

            sum = args1 + args2;

            return sum;



Please try the above sample and get back to us if you have any concerns.

Sellappandi R

Replied On July 1, 2015 09:26 AM UTC

The above Code,only working in Grid Load not in cell edit or cell save.
i want to add the columns while edit the cell not loading.

Sellappandi Ramu [Syncfusion]
Replied On July 2, 2015 01:12 PM UTC

Hi Ganga,

We regret for the inconvenience caused.

We have created a sample by using grid batch edit and used the cellSave event to change the template column value based on changed value. Please refer the following example code.

function cellSave(args) {

        if (args.columnName == "First")

            args.cell.siblings(".e-templatecell").text(args.value + args.rowData.Second);

        else if (args.columnName == "Second")

            args.cell.siblings(".e-templatecell").text(args.value + args.rowData.First);

Please refer the sample from the following link:

Sample link: http://www.syncfusion.com/downloads/support/forum/119475/ze/Sample856743185

Please try the above sample and let us know if it helps. If we misunderstood your query, please provide us clear information regarding your requirements. It will help us to provide the prompt solution.

Sellappandi R

Replied On July 3, 2015 06:57 AM UTC

Thanks,Its Working Fine..

Sellappandi Ramu [Syncfusion]
Replied On July 6, 2015 12:45 PM UTC

Hi Ganga,

Thanks for the update.

Please get back to us if you need any further assistance we are happy to assist you.

Sellappandi R


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