2013-04-29 121 views
1

当我选择'禁用事件'时,我需要清除(无选择)我的前2个单选按钮(CMR conv +出CMR)。用敲除清除单选按钮

是否有可能与淘汰赛?

我已经禁用它们,但我也需要清除它们。

的jsfiddle:http://jsfiddle.net/mnucj/

CMR convention: <input type="radio" name="cmrConvention" value="true" data-bind="checkedRadioToBool: cmrConvention, disable: thirdPartyInsured() ? true : false"> 
<br/> 
Out of CMR convention: <input type="radio" name="cmrConvention" value="false" data-bind="checkedRadioToBool: cmrConvention, disable: thirdPartyInsured() ? true : false"> 
<br/> 
- - - - - - 
<br/> 
Enable things: <input type="radio" name="thirdParty" value="false" data-bind="checkedRadioToBool: thirdPartyInsured"> 
<br/> 
Disable things: <input type="radio" name="thirdParty" value="true" data-bind="checkedRadioToBool: thirdPartyInsured"> 

感谢。

回答

0

您可以使用点击点击“禁用东西”复选框时,像这样绑定:

Disable things: 
<input type="radio" name="thirdParty" value="true" 
     data-bind="checkedRadioToBool: thirdPartyInsured, 
        click: function() { cmrConvention(null); return true; }"> 

updated fiddle

+0

你是对的:收音机已被清除,但副作用:不再选择'禁用事物'点击。任何想法? – Bronzato 2013-04-29 15:30:40

+0

yup :-)匿名函数没有返回任何东西,这会阻止“click”事件传播,因此也不会被检查。你必须返回一些东西来传播。我更新了小提琴:http://jsfiddle.net/mnucj/4/ – Jalayn 2013-04-29 15:36:59

+0

很干净,谢谢。 – Bronzato 2013-04-29 15:38:55