Commit b5ca9079 authored by Jefferyne's avatar Jefferyne

Updates 前端组件/NumericTextBox.md

Auto commit by GitBook Editor
parent f18c9b8e
......@@ -163,7 +163,9 @@ $("#numerictextbox").kendoNumericTextBox({
</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({
},
});
</script>
//设置是否编辑
<h:hlsNumericTextBox id="sumDueAmount" bind="enabled: enabled" style="width:100%"/>
//设置默认值
<h:hlsNumericTextBox id="sumDueAmount" bind="enabled: enabled, value:data.sumDueAmount" style="width:100%"/>
//设置文本框前面的名称
......@@ -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%"/>
```
### 方法:
##### 1.[enable](http://docs.telerik.com/kendo-ui/api/javascript/ui/numerictextbox#methods-enable)
##### 2.[enable](http://docs.telerik.com/kendo-ui/api/javascript/ui/numerictextbox#methods-enable)
说明:是否启用编辑
```html
<h:hlsNumericTextBox id="numerictextbox" bind="enabled: enabled" />
//js实现
//定义数据模型
<script>
$("#numerictextbox").kendoNumericTextBox();
var numerictextbox = $("#numerictextbox").data("kendoNumericTextBox");
numerictextbox.enable(false);
var viewModel = kendo.observable({
enabled: false,//或者true
data: {
},
});
</script>
//设置是否编辑
<h:hlsNumericTextBox id="sumDueAmount" bind="enabled: enabled" style="width:100%"/>
```
![](/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();
![](/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();
</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
<h:hlsNumericTextBox id="numerictextbox" />
<script>
$("#numerictextbox").kendoNumericTextBox();
var numerictextbox = $("#numerictextbox").data("kendoNumericTextBox");
var viewModel = kendo.observable({
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();
//设置值
numerictextbox.value(0.5);
var value = viewModel.data.sumDueAmount
</script>
```
### 事件:
......@@ -271,6 +277,15 @@ numerictextbox.bind("change", function() {
var value = this.value();
});
</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