You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: framework/mvvm/bindings/checked.md
+30Lines changed: 30 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -88,3 +88,33 @@ In this example the second radio button would be checked after calling `kendo.bi
88
88
### Important: a group of radio buttons should have the same name attribute
89
89
90
90
All radio buttons acting as a group should have the same `name` attribute. Only then checking a radio button from the group will uncheck the previously checked one.
91
+
92
+
93
+
## Strongly typed checked binding
94
+
Checkbox inputs bound to an array and radio buttons also support strong typing, using the same principles applied to the [strongly typed value binding](value#strongly-typed-value-binding).
Copy file name to clipboardExpand all lines: framework/mvvm/bindings/value.md
+60Lines changed: 60 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -225,3 +225,63 @@ The third `option` will be displayed as selected. Selecting another `option` wil
225
225
226
226
The second `option` will be displayed as selected. Selecting another `option` will append the corresponding item from the `products` array to the
227
227
`selectedProducts` array. Unselecting an `option` will remove its corresponding item from the `selectedProducts` array.
228
+
229
+
## Strongly typed value binding
230
+
By default the View-Model fields are updated with string values, as this is what the DOM element's value property contains. Since the 2015 Q1 release, Kendo MVVM allows strongly typed value binding by parsing the element's value before updating the View-Model field bound to it. Supported types are `text`, `number`, `date`, `datetime-local` and `boolean`.
231
+
232
+
> To be correctly parsed, the `date` and `datetime-local` values should use strict formatting rules, including the leading zeroes:
233
+
>
234
+
> -`date` - "yyyy-MM-dd"
235
+
> -`datetime-local` - "yyyy-MM-ddTHH:mm:ss"
236
+
237
+
238
+
### Using the type attribute
239
+
Kendo MVVM automatically uses strongly typed value binding based on the input element's `type` attribute.
240
+
```html
241
+
<divid="view">
242
+
<inputtype="number"data-bind="value: Quantity"/>
243
+
<inputtype="date"data-bind="value: ArrivalDate"/>
244
+
</div>
245
+
<script>
246
+
var viewModel =kendo.observable({
247
+
Quantity:22,
248
+
ArrivalDate :newDate()
249
+
});
250
+
kendo.bind($("#view"), viewModel);
251
+
viewModel.bind("change", function(e){
252
+
console.log(e.field, "=", this.get(e.field));
253
+
});
254
+
</script>
255
+
```
256
+
257
+
### Using the data-type attribute
258
+
Explicitly specifying the data type is also supported, via the `data-type` attribute.
0 commit comments