<script type="text/x-jsrender" id="columnTemplate"> {{>~Addition(First, Second)}} </script> @(Html.EJ().Grid<MvcApplication21.OrdersView>("FlatGrid") .Datasource((IEnumerable<object>)ViewBag.datasource) .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(); })) <script> $.views.helpers({ Addition: function (args1, args2) { sum = args1 + args2; return sum; } }); |
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); |
Thanks for the update.
Please get back to us if you need any further assistance we are happy to assist you.
Regards,
Sellappandi R