Hi,
I have 4 columns (Round1, Round2, Round3, Total) of which Total is a non editable int column.Whenever user updates Round1, 2 and 3 by clicking Update.. The total is saved in the database using Employee_Update action and my hope is that Total column will automatically refresh. But thats not happening. Only Round1, 2 and 3 refresh.
Here is my grid
@(Html.Kendo().Grid<EmployeeManagement.Models.Employee>()
.Name("EmployeeGrid")
.Columns(columns =>
{
columns.Bound(p => p.EmployeeID);
columns.Bound(p => p.Round1);
columns.Bound(p => p.Round2);
columns.Bound(p => p.Round3);
columns.Bound(p => p.Total).Width(100);
columns.Command(command => { command.Edit(); }).Width(250);
})
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Pageable(a => a.PageSizes(new int[] { 50, 100 }))
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:700px;" })
.Events(events => { events.Save("updateTotal"); }
)
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(100)
.Model(model =>
{
model.Id(p => p.EmployeeID);
model.Field(p => p.Total).Editable(false);
})
.Update(update => update.Action("Employee_Update", "Admin"))
)
)
<script>
function updateTotal(e) {
var totalCount = 0;
if (e.model.Round1 !== null)
totalCount += 1;
if (e.model.Round2 !== null)
totalCount += 1;
if (e.model.Round3 !== null)
totalCount += 1;
// totalCount has correct total
e.model.set('Total', totalCount); // Doesnt refresh
e.container.parents('tr').find('td:eq(4)').html(totalCount); // Doesnt refresh
e.container[0].children[4].innerText = totalCount; // Doesnt refresh
}
</script>
There are no developer tools console errors.