ZK 10 external radio linked to radiogroup cannot be disabled if Radiogroup is not disabled

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Critical
    • 10.2.0
    • Affects Version/s: 10.0.0, 10.1.0, 10.0.2
    • Component/s: None
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      run fiddle with ZK 10
      https://zkfiddle.org/sample/3pcf0j7/1-radiogroup-disable-zk-10

      Current Result

      external radio are not disabled

      Expected Result

      external radio are disabled

      Debug Information

      caused by
      https://github.com/zkoss/zk/commit/54dc369cdf0752807daaab6a32f42ad6154f87e6#diff-e5c6a8806310046f4bbac717ba2334e10b570922d5f34e3405fd922df3c87617R232

      Workaround

      Widget-side radiogroup _fixOnAdd JS function always set the disabled state to the same as the radiogroup on external radio
      NOTE: this reverts a change made for Stateless components.
      If you are using stateless components, you may encounter unexpected side-effects with this workaround

      		<script><![CDATA[
      			zk.afterLoad("zul.wgt", function () {
      			    var _xRadiogroup = {};
      			    zk.override(zul.wgt.Radiogroup.prototype, _xRadiogroup, {
      			    	_fixOnAdd : function(t) {
                              this._jsel >= 0 && t.isSelected() ? t.setSelected(!1) : this._fixSelectedIndex(),
                              t.setDisabled(this.isDisabled() || t.isDisabled()) //rg disabled || radio disabled == radio disabled, radio enabled only if both Rg and Radio are not disabled
                          }
      			     });
      			});
      		]]></script>
      

            Assignee:
            DevChu
            Reporter:
            MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: