When creating a new entry in listview and deciding to cancel the creation, the entry is removed from listview, but I have problems to get first item selected after that.
The cancel event seems to have a timing problem.
Here is my ListView:
@(Html.Kendo()
.ListView(Model)
.Name("lstvPermissionGroup")
.TagName("div")
.ClientTemplateId("permissionGroupTemplate")
.ClientAltTemplateId("permissionGroupTemplate")
.Editable()
.DataSource(ds => ds
.Model(model =>
{
model.Id("Id");
model.Field(f => f.CompanyId).DefaultValue(@Model.First().CompanyId);
})
.Create(create => create.Action("PermissionGroupCreate", "User"))
.Update(update => update.Action("PermissionGroupUpdate", "User"))
.Read(read => read.Action("PermissionGroups", "User").Data("additionalData") )
.Destroy(destroy => destroy.Action("PermissionGroupDelete", "User"))
.Events(e =>
{
e.RequestEnd("onRequestEnd");
e.Error("onError");
})
)
.Selectable()
.Events(ev =>
{
ev.Change("onChange");
ev.Cancel("onCancel");
})
)
and that is my cancel event:
function onCancel(e) {
var listView = $('#lstvPermissionGroup').data('kendoListView');
listView.select(listView.element.children().first());
}
The cancel event seems to have a timing problem.
Here is my ListView:
@(Html.Kendo()
.ListView(Model)
.Name("lstvPermissionGroup")
.TagName("div")
.ClientTemplateId("permissionGroupTemplate")
.ClientAltTemplateId("permissionGroupTemplate")
.Editable()
.DataSource(ds => ds
.Model(model =>
{
model.Id("Id");
model.Field(f => f.CompanyId).DefaultValue(@Model.First().CompanyId);
})
.Create(create => create.Action("PermissionGroupCreate", "User"))
.Update(update => update.Action("PermissionGroupUpdate", "User"))
.Read(read => read.Action("PermissionGroups", "User").Data("additionalData") )
.Destroy(destroy => destroy.Action("PermissionGroupDelete", "User"))
.Events(e =>
{
e.RequestEnd("onRequestEnd");
e.Error("onError");
})
)
.Selectable()
.Events(ev =>
{
ev.Change("onChange");
ev.Cancel("onCancel");
})
)
and that is my cancel event:
function onCancel(e) {
var listView = $('#lstvPermissionGroup').data('kendoListView');
listView.select(listView.element.children().first());
}