设置值时,KendoNumericTextbox不会更新

时间:2016-08-23 20:57:00

标签: kendo-ui kendonumerictextbox

我在更新val更新kendoNumericTextBox时遇到问题,直到我将光标放入文本框才会显示它。



 $(document).ready(function () {
 
 $('#txtCorpEl').kendoNumericTextBox({}).data("kendoNumericTextBox");
 
 $('#txtCorpEl').value(5);
 
 $('#txtCorpEl').focus();
 
 //var numerictextbox = $("#txtCorpEl").data("kendoNumericTextBox");
//numerictextbox.focus();
 
 });
 
 
 function onChange() {
    console.log("event: change");
};

<link href="http://cdn.kendostatic.com/2011.3.1129/styles/kendo.common.min.css" rel="stylesheet"/>
<link href="http://cdn.kendostatic.com/2011.3.1129/styles/kendo.default.min.css" rel="stylesheet"/>
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>        
<script src="http://cdn.kendostatic.com/2011.3.1129/js/kendo.all.min.js"></script>
 <input id="txtCorpEl" />
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:2)

我测试时工作正常。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
  <link href="http://cdn.kendostatic.com/2011.3.1129/styles/kendo.common.min.css" rel="stylesheet"/>
<link href="http://cdn.kendostatic.com/2011.3.1129/styles/kendo.default.min.css" rel="stylesheet"/>
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>        
<script src="http://cdn.kendostatic.com/2011.3.1129/js/kendo.all.min.js"></script>
</head>
<body>
 <input id="txtCorpEl" />
<script>
    $(document).ready(function () {
        $("#txtCorpEl").kendoNumericTextBox();
     var numerictextbox = $("#txtCorpEl").data("kendoNumericTextBox");
 numerictextbox.value(5); 
 });
</script>
</body>
</html>
相关问题