How can I have kendo NumericTextBox keep focus during highlighting in a kendo window?

大城市里の小女人 提交于 2019-12-12 05:16:17

问题


I have a kendo window that contains a kendo numeric text box:

$('input').kendoNumericTextBox({
    decimals: 2,
    spinners: false
});


 $('#win').kendoWindow({
     modal: true,
     width: "969px",
     height: "646px",
     title: "NumericTextBoxTest"
 });

 $('#win').data('kendoWindow').center().open();

The jsfiddle is here http://jsfiddle.net/e6shF/40/.

In Firefox, you are unable to highlight the numeric text box value. In Chrome, you can highlight the value but can't type over the value while it is highlighted.

It appears to be a focus issue due to improper z-indexing. I'm using kendo version 2012.3.1114 (latest GPL release). This issue is no longer present in kendo version 2012.3.1315 but that version doesn't appear to be available under GPL. How can I resolve this issue using kendo 2012.3.1114?


回答1:


Adding a .focus() event listener to the input, wrapped in a setTimeout with an input.select() seems to force it to behave normally.

$('input').kendoNumericTextBox({
    decimals: 2,
    spinners: false
}).focus(function() {
   var input = $(this);
    setTimeout(function() {
        input.select();
    });
});

Fiddle: http://jsfiddle.net/HwrzV/1/

Works for me now in Firefox and Chrome. Tried to test IE8 but JSFiddle doesn't load. :x



来源:https://stackoverflow.com/questions/14656847/how-can-i-have-kendo-numerictextbox-keep-focus-during-highlighting-in-a-kendo-wi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!