Completed
Last Updated: 17 Jan 2017 09:39 by ADMIN
Julie
Created on: 10 Dec 2014 16:38
Category: MVVM
Type: Feature Request
3
radio button bind to boolean
Currently radio buttons can only bind to a string. They need to bind to a boolean value so we can have clean models, otherwise we have to put in ugly functions to convert the string to a boolean within the model.
4 comments
MR
Posted on: 25 Jan 2016 04:30
It seems kendo validator is not updated to support this (no tooltip is shown when a nullable boolean value)
ADMIN
Telerik Admin
Posted on: 25 Mar 2015 11:59
Strongly typed Kendo UI MVVM value bindings (including this case with radio buttons value binding) are supported with Q1 2015.
ADMIN
Telerik Admin
Posted on: 12 Dec 2014 15:45
Now I see what you mean, and reverted the status of the item.
Julie
Posted on: 12 Dec 2014 10:22
I've made a small change to the Dojo to represent how I am using it which breaks it:
<div>
                <label><input type="radio" value="true" name="EnableGroup" data-bind="checked: isEnabled">Enable</label>
               <label><input type="radio" value="false" name="EnableGroup"  data-bind="checked: isEnabled">Disable</label>
            </div>
            <div>
                <label><input type="radio" value="true" name="VisibleGroup"  data-bind="checked: isVisible">Visible</label>
               <label><input type="radio" value="false" name="VisibleGroup" data-bind="checked: isVisible">Invisible</label>
            </div>

Once the options are changed, the settings in the view model are changed to strings. This means that the other control bound to those properties no longer responds when the options to disable or hide the control is checked. I've had to create a string version of the property and a click event which synchronises the string into the bool in order to make it work, which makes for an ugly model.