Hi
I have been reading that there is a save event which gets triggered when a cell is left in the grid. I tried that and its working fine when I use GridEditMode.InCell as the edit mode. When I use GridEditMode.InLine nothing happens when I leave the cell (the function is not being called). But, the function is being called after i click on the "Update" button. In my scenario, i need to update some cells regarding to what was written in some other cells, so no use for me to call the function just before saving. So is there a method to notify me just when a cell has been left (or a value inside of a cell has been changed or selected e.g. from an autocomplete)
Here is my code
@(Html.Kendo().Grid<Telerik2.Models.LeistungViewModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(l => l.LeistungNr).Width(240).Visible(false);
columns.Bound(l => l.Bezeichnung).Width(190);
columns.Bound(l => l.Datum).EditorTemplateName("DatumPicker").Width(110).Format("{0:dd.MM.yyyy}");
columns.Bound(l => l.MinT).Width(110); ;
columns.Bound(l => l.Kuerzel).EditorTemplateName("LeistungKuerzel").Width(130);
columns.Bound(l => l.MinV).Width(110);
columns.Bound(l => l.Person).Width(160);
columns.Command(command => { command.Edit().Text("Bearbeiten").UpdateText("Speichern").CancelText("Abbrechen"); }).Width(200);
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Pageable()
.Events(events => events.Save("Save"))
.Sortable()
.Resizable(resize => resize.Columns(true))
.Scrollable()
)
<script type="text/javascript">
function Save(e) {
console.log("Cell left");
}
}
</script>
"My issue is with the EditMode button. I have 10 cells, and when I click to edit any cell, it automatically scrolls to the left, focusing on the first editable cell (which is a dropdown or text input). Is there any attribute or JavaScript solution to resolve this issue?"
My code
EditMode="@GridEditMode.Inline"
void OnEditHandler(GridCommandEventArgs args)OnEdit="@OnEditHandler"
{
var materialdata = (PlanningMaterialOuputModel)args.Item;
if (!string.IsNullOrEmpty(materialdata.Sap))
{
oldSapValue = materialdata.Sap;
sapeditable = true; SearchVisible = true;
enableDesc = false; enableUnit = false;
}
else
{
sapeditable = false; SearchVisible = false;
enableDesc = true; enableUnit = true;
}
pMaterialId = materialdata.Id;
}