-
Bug
-
Resolution: Fixed
-
Normal
-
8.0.5
-
None
-
Security Level: Jimmy
-
None
-
None
Steps to Reproduce
run fiddle
http://zkfiddle.org/sample/2ve4vpa/2-Splitter-no-onchanging-after-workaround
(include onChanging workaround for #ZK-3649)
Click outside of the 1st spinner.
Click arrow up on 1st spinner
Click outside again
Click arrow up again
Current Result
onChanging events doesn't trigger If this._lastChange is null during _btnUp (ie blur cleaned up this._lastChg)
Expected Result
onChanging should trigger on each up or down arrow clicks including first click
Debug Info
_clearOnChanging will remove the value of _lastChg
https://github.com/zkoss/zk/blob/master/zul/src/archive/web/js/zul/inp/InputWidget.js#L983
while called by doBlur_() > _stopOnChanging > _clearOnChanging
https://github.com/zkoss/zk/blob/master/zul/src/archive/web/js/zul/inp/InputWidget.js#L473
https://github.com/zkoss/zk/blob/master/zul/src/archive/web/js/zul/inp/InputWidget.js#L969
wgt._lastChg isn't set again before _btnUp, which cause onChanging to fail.
Root Cause
wgt._lastChg is null before triggering onChanging, which cause onChanging to be ignored
Workaround
INCLUDING WORKAROUND FOR ZK-3649
<script><![CDATA[ zk.afterLoad('zul.inp', function() { var xSpinner = {}; zk.override(zul.inp.Spinner.prototype, xSpinner ,{ _btnUp : function() { //before var result = xSpinner._btnUp .apply(this, arguments); //after this._lastChg = this.valueBeforeMouseDown?this.valueBeforeMouseDown:this._value?this.value:0; var inputWidget = zul.inp.InputWidget; inputWidget._stopOnChanging(this); this.proxy(inputWidget._onChanging)(); return result; }, _btnDown : function() { //before this.valueBeforeMouseDown = this._value; var result = xSpinner._btnDown .apply(this, arguments); //after return result; } });//zk.override });//zk.afterLoad ]]></script>
- relates to
-
ZK-3649 Spinner doesn't send onChanging events following ZK-3530
- Closed