-
Bug
-
Resolution: Fixed
-
Normal
-
9.5.1.3
-
Security Level: Jimmy
-
None
Steps to Reproduce
Run locally (somehow fiddle causes events to cascade and trigger an additional call)
https://zkfiddle.org/sample/3scu23s/2-listbox-ee-rod-scroll
Current Result
Listbox scroll to item 25
Expected Result
Listbox scroll to item 500
Debug Information
the scrollToIndex invokation is executed during the command processing, before init pads.
At this stage, the listbox hasn't triggered onRender, and pads are not initialized
So it scrolls by a ration of the currently rendered item count instead of the actual requested position
Workaround
wait for render if render is pending:
<script><![CDATA[ zk.afterLoad("zul.sel", function () { var _xListbox = {}; zk.override(zul.sel.Listbox.prototype, _xListbox, { scrollToIndex: function(index, scrollRatio) { function scrollLater(self,selfArgs){ if(self._pendOnRender){ setTimeout(function(){scrollLater(self, selfArgs)},0); }else{ _xListbox.scrollToIndex.apply(self, selfArgs); } } scrollLater(this, arguments); } }); }); ]]></script>
- relates to
-
ZK-3952 Grid/Listbox provide an API to scroll itself by item index
- Closed