Commit b5ca9079 authored by Jefferyne's avatar Jefferyne

Updates 前端组件/NumericTextBox.md

Auto commit by GitBook Editor
parent f18c9b8e
...@@ -163,7 +163,9 @@ $("#numerictextbox").kendoNumericTextBox({ ...@@ -163,7 +163,9 @@ $("#numerictextbox").kendoNumericTextBox({
</script> </script>
``` ```
##### 10.[bind](http://docs.telerik.com/kendo-ui/api/javascript/ui/numerictextbox#configuration-value) 及默认值的设置 ### 方法:
##### 1.[bind](http://docs.telerik.com/kendo-ui/api/javascript/ui/numerictextbox#configuration-value) 及默认值的设置
说明:设置默认值 说明:设置默认值
...@@ -177,8 +179,6 @@ var viewModel = kendo.observable({ ...@@ -177,8 +179,6 @@ var viewModel = kendo.observable({
}, },
}); });
</script> </script>
//设置是否编辑
<h:hlsNumericTextBox id="sumDueAmount" bind="enabled: enabled" style="width:100%"/>
//设置默认值 //设置默认值
<h:hlsNumericTextBox id="sumDueAmount" bind="enabled: enabled, value:data.sumDueAmount" style="width:100%"/> <h:hlsNumericTextBox id="sumDueAmount" bind="enabled: enabled, value:data.sumDueAmount" style="width:100%"/>
//设置文本框前面的名称 //设置文本框前面的名称
...@@ -189,25 +189,26 @@ var viewModel = kendo.observable({ ...@@ -189,25 +189,26 @@ var viewModel = kendo.observable({
<h:hlsNumericTextBox id="sumDueAmount" bind="enabled: enabled, value:data.sumDueAmount" colspan="3" prompt="注册资本" promptColspan="1" style="width:100%"/> <h:hlsNumericTextBox id="sumDueAmount" bind="enabled: enabled, value:data.sumDueAmount" colspan="3" prompt="注册资本" promptColspan="1" style="width:100%"/>
``` ```
### 方法: ##### 2.[enable](http://docs.telerik.com/kendo-ui/api/javascript/ui/numerictextbox#methods-enable)
##### 1.[enable](http://docs.telerik.com/kendo-ui/api/javascript/ui/numerictextbox#methods-enable)
说明:是否启用编辑 说明:是否启用编辑
```html ```html
<h:hlsNumericTextBox id="numerictextbox" bind="enabled: enabled" /> //定义数据模型
//js实现
<script> <script>
$("#numerictextbox").kendoNumericTextBox(); var viewModel = kendo.observable({
var numerictextbox = $("#numerictextbox").data("kendoNumericTextBox"); enabled: false,//或者true
numerictextbox.enable(false); data: {
},
});
</script> </script>
//设置是否编辑
<h:hlsNumericTextBox id="sumDueAmount" bind="enabled: enabled" style="width:100%"/>
``` ```
![](/assets/193025.png) ![](/assets/193025.png)
##### 2.[readonly](http://docs.telerik.com/kendo-ui/api/javascript/ui/numerictextbox#methods-readonly) ##### 3.[readonly](http://docs.telerik.com/kendo-ui/api/javascript/ui/numerictextbox#methods-readonly)
说明:是否启用只读 说明:是否启用只读
...@@ -222,7 +223,7 @@ numerictextbox.readonly(); ...@@ -222,7 +223,7 @@ numerictextbox.readonly();
![](/assets/93141.png) ![](/assets/93141.png)
##### 3.[focus](http://docs.telerik.com/kendo-ui/api/javascript/ui/numerictextbox#methods-focus) ##### 4.[focus](http://docs.telerik.com/kendo-ui/api/javascript/ui/numerictextbox#methods-focus)
说明:聚焦 说明:聚焦
...@@ -235,20 +236,25 @@ numerictextbox.focus(); ...@@ -235,20 +236,25 @@ numerictextbox.focus();
</script> </script>
``` ```
##### 4.[value](http://docs.telerik.com/kendo-ui/api/javascript/ui/numerictextbox#methods-value) ##### 5.[value](http://docs.telerik.com/kendo-ui/api/javascript/ui/numerictextbox#methods-value)
说明:获取和设置值 说明:获取和设置值
```html ```html
<h:hlsNumericTextBox id="numerictextbox" />
<script> <script>
$("#numerictextbox").kendoNumericTextBox(); var viewModel = kendo.observable({
var numerictextbox = $("#numerictextbox").data("kendoNumericTextBox"); enabled: false,//或者true
data: {
sumDueAmount:10000
},
});
</script>
<h:hlsNumericTextBox id="sumDueAmount" bind="enabled: enabled, value:data.sumDueAmount" colspan="3" prompt="注册资本" promptColspan="1" style="width:100%"/>
<script>
//获取值 //获取值
var value = numerictextbox.value(); var value = viewModel.data.sumDueAmount
//设置值
numerictextbox.value(0.5);
</script> </script>
``` ```
### 事件: ### 事件:
...@@ -271,6 +277,15 @@ numerictextbox.bind("change", function() { ...@@ -271,6 +277,15 @@ numerictextbox.bind("change", function() {
var value = this.value(); var value = this.value();
}); });
</script> </script>
//方法三
<h:hlsNumericTextBox id="numerictextbox" bind="enabled: enabled, value:data.numerictextbox" change="change" style="width:100%"/>
<script>
function change(){
alert("改变事件")
}
</script>
``` ```
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment