9 Answers, 1 is accepted
UPDATE (10/2012): The NumericTextBox widget now have "focus" method which should be used instead of the following solution.
Hello Paul,
As you probably know, the NumericTextBox has two input elements. The one which you try to focus is hidden. In order to achieve your goal you just need to focus the visible input. Check this jsBin demo.
As a side note, although we monitor forum threads, we do not guarantee a timely reply there. If you need a guaranteed answer in 24 hour response time, then I will suggest you open a support ticket.
Georgi Krustev
the Telerik team
In the latest internal build, we add a focus() method, which will focus the widget. It will be documented for the comming service pack (scheduled for the mid of September).
Georgi Krustev
the Telerik team
template for one widget
<div class="mvvmElement mvvmBorder" data-bind="visible: obj_priceUM.visible" style="left:40px; top:88px; width:112px; height:36px; z-index:0">
<label class="mvvmLabel right" style="width:100%;">
Cena za EM
<br />
<input data-role="numerictextbox" data-format="n2" data-decimals="2" data-spinners="false" data-bind="value: obj_priceUM.value, enabled: obj_priceUM.enabled" style="width:112px;" />
</label>
</div>
videmodel
obj_priceUM: {
visible: true, value: "0", enabled: true
}
Currently, Kendo MVVM does not provide a focus binder. Nevertheless, you can define a custom one, which will focus the widget.
Regards,
Georgi Krustev
Telerik
On the afterShow binding for the view, I call this code: $("#input_id").siblings("input:visible").focus();
Also put the autofocus tag on the HTML input.
For the maskedTextBox, I use autofocus and $("input_id").focus() for the afterShow view event.
I would like to share with you that as of Kendo UI version 2020.2.617, our team has added the "selectOnFocus" property covering the pointed requirements in this thread. For your future web development, feel free to utilize this implementation shown here:
<input id="numerictextbox" />
<script>
$("#numerictextbox").kendoNumericTextBox({
selectOnFocus: true
});
</script>
Kind Regards,
Anton Mironov
Progress Telerik
Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).