I've got a grid using the InCell edit mode with a custom editor template, and I'm trying to select all the text when the user clicks the cell to edit. I've seen (and tried) several suggestions in other forums, but they simply don't work for me. Currently, I'm down to this, which doesn't work but seems like it should:
Editor template:
@model decimal?
@(Html.Kendo().NumericTextBoxFor(m => m)
.Decimals(2)
.RestrictDecimals(true)
.Spinners(false)
.HtmlAttributes(new { style = "width:100%" })
)
In the client-side edit handler:
e.container.find(
'input'
).each(
function
() {
var
editor =
this
;
setTimeout(
function
() { editor.select(); });
});
The reason I'm using .each is that there seems to be two input elements in the edit container. I've tried .select on each of them individually, to no avail.
Any thoughts on this?