我的单选按钮的html是:
<div class="slds-form-element" style="text-align:center;">
<div id="radio-wrapBorder" style="border-top: 2px solid #f48942;"></div>
<label class="slds-form-element__label" for="radio-wrap" style="color: white; font-size: 15px; margin-top: 5px;">Allow Users To Control Their Drag And Drop Settings:</label>
<div class="slds-form-element__control">
<div id="radio-wrap">
<input type="radio" class="k-radio" id="radioDisableDragDrop" value="DisableAll" name="radioGroup" data-bind="checked: radioDragDrop" style="margin-top: 5px; margin-bottom: 15px;"/><label for="radioDisableDragDrop" class="k-radio-label" id="radioDisableDragDropLabel" style="color: white;">Drag and Drop <b>DISABLED</b> for all users. This will not show up as an option in user settings.</label><br />
<input type="radio" class="k-radio" id="radioEnableDragDrop" value="EnableAll" name="radioGroup" data-bind="checked: radioDragDrop" style="margin-top: 5px; margin-bottom: 15px;"/><label for="radioEnableDragDrop" class="k-radio-label" id="radioEnableDragDropLabel" style="color: white;">Drag and Drop <b>ENABLED</b> for all users. This will not show up as an option in user settings.</label><br />
<input type="radio" class="k-radio" id="radioUserDragDrop" value="EnableUser" name="radioGroup" data-bind="checked: radioDragDrop" style="margin-top: 5px; margin-bottom: 15px;"/><label for="radioUserDragDrop" class="k-radio-label" id="radioUserDragDropLabel" style="color: white;">Drag and Drop determined by user preferences.</label>
</div>
</div>
</div>
我的绑定观察是:
var radioObservable = kendo.observable({
radioDragDrop: null
});
kendo.bind($('#radio-wrap'), radioObservable);
radioObservable.set('radioDragDrop', 'EnableUser');
console.log(radioObservable);
在单选按钮正确的情况下,最初选择我放入radioObservable.set()方法中的任何内容。但是,当我选择其他选项时,单击“保存...”radioDragDrop仍为“EnableUser”。
当你选择3个单选按钮的不同选项时,任何人都可以看到这个绑定会导致radioDragDrop不更新吗?
答案 0 :(得分:0)
我创建了一个DEMO,并且单选按钮与可观察对象的绑定似乎正常工作。
以下是一些代码段:
<强> JS:强>
var radioObservable = kendo.observable({
radioDragDrop: null,
});
kendo.bind($('#radio-wrap'), radioObservable);
radioObservable.set('radioDragDrop', 'EnableUser');//default checked option
//radioObservable.trigger('change');
console.log(radioObservable);
$("#save").click(function() {
alert("current selected option = "+radioObservable.get('radioDragDrop'));
});