[RESOLVED, FOR NOW] Telerik Kendo Listbox Prevent Item Deletion by Delete Keypress
May be a long shot but does anyone use or know how to do as the title says?
When I enable keyboard navigation to allow users to use arrow keys to change selections up or down etc if they press the delete key it actually deletes the selected listitem
Kendo MVC btw
Thanks
Code:
<div>
@(Html.Kendo().ListBox()
.Name("MyListbox")
.Navigatable(false)
.Selectable(ListBoxSelectable.Single)
.DataTextField("fieldValue")
.DataValueField("fieldName")
.DataSource(dataSource => dataSource
.Read(read => read.Action("ControllerMethod", "Controller", new { id = Model.id }))
)
.HtmlAttributes(new { style = "width: 95%; margin-right: 15px; height: 250px;" })
)
</div>
Re: Telerik Kendo Listbox Prevent Item Deletion by Delete Keypress
I have zero experience using it.
When I googled, found this link: https://docs.telerik.com/kendo-ui/co...s-on-backspace
That is, see if you can add the javascript code to attach a keydown event to that ListBox, and then check whether the key pressed is a delete button (keycode is 46).
If so, prevent the default action (which is deletion).
Hope it will help :wave:
Re: Telerik Kendo Listbox Prevent Item Deletion by Delete Keypress
Thanks but I think for now I'm just going to disable keyboard navigation as I realized there isn't a case (yet) where they need to actually select this listbox items
.Navigatable(false) 'Disabled