Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4821

tri-state checkmark still checks while disable when clicking in the border

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 9.6.0
    • 9.5.1
    • Components
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      https://zkfiddle.org/sample/1up95ua/2-tri-state-checkmark-disabled

      Click inside the red square, but outside the checkmark for the 1st and 2nd checkmarks (3 and 4 are regular checkmarks)

      these checkboxes are disabled.

      Current Result

      checkbox state is updated

      Expected Result

      checkbox state is not updated

      Debug Information

      There is on disabled check in the checbox doClick.

      Regular checkbox have 2 workflows:

      • If click on disabled html checkmark: no event due to disabled dom element not firing event
      • if click inside the border of the checkbox component, but outside the html checkmark, the doClick_ method will fire and check if dom checked status == current checked status. If yes, it returns and does not update.

      On tri-state checkbox:

      doClick_ (from dom checkmark, or from outer checkbox span) directly trigger changeState. disabled dom checkmark doesn't fire events, but the outer checkbox span will still resolve to the doClick_ method.

      Workaround

      Add a disable check:

      <script><![CDATA[ 
      		zk.afterLoad("zul.wgt", function () {
      		    var _xCheckbox = {};
      		    zk.override(zul.wgt.Checkbox.prototype, _xCheckbox, {
      		        doClick_: function() {
      		    		if(this.isDisabled()){
      		    			return;
      		    		}
      					var result = _xCheckbox.doClick_.apply(this, arguments);
      					return result;
      		        }
      		     });
      		});
      	]]></script>
      

            Leon03 Leon03
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: