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.
@(Html.EJ().TreeGrid("TreeGridContainer")
//…
.Columns(co => {
//…
co.Field("PercentDone").HeaderText("Progress").Add();
}).
ClientSideEvents(eve => {
eve.EndEdit("endedit");
}).
Datasource(ViewBag.dataSource))
<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);
}
}
</script>
|
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
Regards,
Mahalakshmi K.