-
Bug
-
Resolution: Fixed
-
Major
-
8.0.5
-
None
-
Security Level: Jimmy
-
None
Steps to Reproduce
run fiddle:
http://zkfiddle.org/sample/1gsdtbq/1-Splitter-no-onchanging
click on arrows up or down on the first spinner
Current Result
onChanging is not called clicks.
onChanging is evaluated during blur
Expected Result
onChanging should be called for each click
Debug Info
Most components will perform some variation of
this.proxy(inputWidget._onChanging)();
when triggering onChanging (usually inside a timeout)
Spinner calls onChanging directly during _btnUp
https://github.com/zkoss/zk/blob/884e074c3ab999798dcf38b01564ec1f4c940818/zul/src/archive/web/js/zul/inp/Spinner.js#L158
which then in turn invoke the static _onChanging here:
https://github.com/zkoss/zk/blob/master/zul/src/archive/web/js/zul/inp/InputWidget.js#L424
in this scenario, when the actual onChanging function is called here:
https://github.com/zkoss/zk/blob/master/zul/src/archive/web/js/zul/inp/InputWidget.js#L941
the 'this' object doesn't refer to the spinner wgt (as it would in a proxied method) but to the function object instead. since this is invalid, _onChanging fails.
Root Cause
Change of architecture
https://github.com/zkoss/zk/commit/3c05a5010116e6cd70a751daf2735206cd9487b3
Workaround
<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 var inputWidget = zul.inp.InputWidget; inputWidget._stopOnChanging(this); this.proxy(inputWidget._onChanging)(); return result; } });//zk.override });//zk.afterLoad ]]></script>