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

how to get the sum for certain column data in treegrid?

Thread ID:





120786 Oct 14,2015 07:47 PM UTC Oct 16,2015 05:09 AM UTC ASP.NET MVC 3
Tags: TreeGrid
Harry Zheng
Asked On October 14, 2015 07:47 PM UTC


In treegrid, I have a column "Percent", in which user can input number. I'd like to calculate the total percent each time user finish entering number.
In that way, I can ensure the total number input for the column will not be greater than 100.
How do I get the total sum for column "Percent"?


Mahalakshmi Karthikeyan [Syncfusion]
Replied On October 15, 2015 10:13 AM UTC

Hi Harry,

We can get the sum of particular column after the editing with the help of “EndEdit” client side event. Please refer the below code example for details.



.Columns(co => {




ClientSideEvents(eve => {




<script type = "text/javascript" >

function endedit(args) {

       var percentValue = parseInt(args.data.PercentDone);

       if (args.columnName == "PercentDone") {

              var treeObj = $("#TreeGridContainer").data("ejTreeGrid");

              var records = treeObj.model.flatRecords;

              for (var i = 0; i < records.length; i++) {

                     if (!ej.isNullOrUndefined(records[i].PercentDone) && records[i].index != args.data.index) percentValue += records[i].PercentDone;


              if (percentValue > 100) args.cancel = true

              alert("Total of Percent Column is" + percentValue);




Here we have displayed the sum of percent column in alert box, and cancelled the editing if the entered value makes the sum greater than 100 using “args.cancel=true”.

Can you please share us more details about the percentage value you have considered as 100% to convert the sum value to percentage?

We have also prepared a sample based on this and you can find the sample under the following location.

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/SumThePercentage705145007


Mahalakshmi K.

Harry Zheng
Replied On October 15, 2015 06:10 PM UTC

Hi Mahalakshmi,

Thank you for the solution. It's working!


Mahalakshmi Karthikeyan [Syncfusion]
Replied On October 16, 2015 05:09 AM UTC

Hi Harry,

Thanks for the update.

Please let us know if you need further assistance on this.


Mahalakshmi K.


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

or the page will be automatically redirected to 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