I have a child-grid where I want to to subtract the 'Value' column-cell with the previous 'Value' column-cell client-side, I tried using a ClientTemplate but I couldn't get it to work .
Ex, Let's say I am looking at the 'Value' with the 'SensorId' 3, I want the 'Change' column to be: 'Value' where 'SensorId' == 3 - 'Value' where 'SensorId' == 4, and so forth.
Thanks in advance.
@(
Html.Kendo().Grid<
ErvinBeta.Models.ViewModels.ValueViewModel
>().Name("ValueGrid#=SensorId#")
.DataSource(ds => ds.Ajax()
.Model(m => m.Id(sv => sv.SensorId))
.PageSize(15)
.Read(read => read.Action("ReadValue", "Home", new { SensorId = "#=SensorId#" }))
.Sort(sort => sort.Add(sv => sv.Timestamp).Descending()))
.Columns(columns =>
{
columns.Bound(sensorValue => sensorValue.ValueId).Visible(false);
columns.Bound(sensorValue => sensorValue.SensorId).Visible(false);
columns.Bound(sensorValue => sensorValue.Value).Title("Value")
.HtmlAttributes(new { @class = "valueColumn" }).Width(150)
.Filterable(ftb => ftb.Cell(cell => cell.Operator("contains"))
.Cell(cell => cell.ShowOperators(false)));
columns.Bound(sensorValue => sensorValue.Category.Unit)
.Title("Unit").Width(200).Filterable(false);
columns.Bound(sensorValue => sensorValue.Timestamp).Title("Timestamp")
.Format("{0:yyyy-MM-dd}").Filterable(ftb => ftb.Cell
(cell => cell.Operator("contains")).Cell(cell => cell.ShowOperators(false)));
})
.Scrollable()
.Pageable()
.Sortable()
.Filterable(ftb => ftb.Mode(GridFilterMode.Row))
.HtmlAttributes(new { style = "height: 600px;", @class="valueTable"})
.ToClientTemplate()
)