Hi,
I have written a function that triggers when the Update event on the grid ends. This is defined as :
.DataSource(dataSource => dataSource
.Ajax()
.Events(events =>
{
events.RequestEnd("onUpdateEnd");
})
.Model(model =>
{
model.Id(p => p.vessel_idx);
})
My function is as follows:
function onUpdateEnd(e) {
if (e.type == "update") {
var grid = $("#Grid").data("kendoGrid"),
dataItem = grid.dataItem($(this).closest("tr")),
stop_date = document.getElementById("fixture_stop"),
start_date = dataItem.fixture_start;
if (end_date < start_date) {
alert("Dates are wrong")
} else {
alert("Dates are correct")
}
$("#Grid").data("kendoGrid").dataSource.read();
}
}
The problen that once the updateend function trigger, the console returns an error saying that dataItem is null (start_date) which crashes the application. What am I doing wrong and why can't I grab that cell data for use in my function?
Many thanks