Scrollbar in Listbox moves to last selected item

asked 超碰在热线精品视频6gaovideos超碰在线网址gao41 超碰视频免费美高级官员:美国只欢迎“能自立更生”的移民


露她呆在這里使你神經撕裂!于是我故意裝傻,相當漠不關心地說道︰ “唉,這種事情是常有的!她的脾氣時陰時晴,像天氣一樣瞬息萬變, 超碰在热线精品视频6 前面司機旁邊還有座位。後座你當然沒法坐,我已經邀請了我那傻頭傻腦的gaovideos超碰在线网址 不干不淨地老是影射暗示,仿佛我在城外成了一個食客似的。 “見鬼,讓我安靜一會兒,收起你的這些愚蠢的笑話吧!”我對他嚷道。 這個該死的費倫茨,老是發出這種好心好意的、粘粘糊糊的笑聲,嘴里gao41 超碰视频免费 己一眼就看出幾分了。如果真的到了這個地步,那麼規勸、攔阻全都已經無 濟于事。當朋友的就只好挺身而出。一切都會辦得妥妥帖帖,對此,用不著 再特別擔保。只不過有一點,霍夫米勒,你明理曉事,總不會幻想,你在我 們那兒辦事,我會讓你一上來就地位顯赫,步步高升。這樣的事情在任何一 個正經的企業里都沒有的。如果來了個人平白無故地就跳過別人的肩膀躥上 去,只會使別人心生憎恨。你必須從最底層干起,說不定先得坐在賬房里干 幾個月愚蠢無聊的抄抄寫寫的活,然後才能把你派到海外的種植園去或者想 方設法變點花樣出來。反正,我已經說過了,我會張羅這件事的。明天我妻 子和我就動身,在巴黎逛那麼八到十天,然後我們就到勒阿弗爾和安特衛普 去幾天,視察幾家代理處。不過最多三星期我們就回來,一到鹿特丹我就寫 信給你。別擔心——我忘不了!你對巴林凱盡可放心。” 2019-07-29 16:02:29 +0800

anvibb gravatar image anvibb
3 1

Hi, guys! I have some trouble with scrollbar in the Listbox component - when I set the model to it and selecting several listitems, the scrollbar moves down to the last selected item, but I need to keep it on top. We've used simple zul as a view:

<window xmlns="http: //www.zkoss.org/2005/zul" xmlns:xsi="http: //www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http: //www.zkoss.org/2005/zul http: //www.zkoss.org/2005/zul/zul.xsd"
        closable="true" border="normal" title="Customize columns" ctrlKeys="" height="400px" width="300px">
    <borderlayout width="100%" height="100%">
            <listbox id="table" checkmark="true" vflex="true" fixedLayout="true" multiple="true" width="100%">
                    <listheader align="left">Column title</listheader>

        <south size="36" autoscroll="true">
            <toolbar align="end">
                <button label="OK" id="okButton" height="24px" width="75px" mold="os"/>
                <button label="Reset" id="resetButton" height="24px" width="75px"/>
                <button label="Cancel" id="cancelButton" height="24px" width="75px" mold="os"/>


In SetDocColumnsView I filled Listbox by model and make some AfterCompose actions:

public void configureView(List<? extends HeaderElement> columns, Set<String> hiddenIds) {

    final ListModelList tableModel = new ListModelList(columns);
    for (int i = 0; i < columns.size(); i++) {
        final HeaderElement column = columns.get(i);
        if (column != null) {
            final Listitem listitem = table.getItemAtIndex(i);
            final String columnId = column.getId();
public void afterCompose() {
    table = (Listbox) getFellow("table");
    final Button okButton = (Button) getFellow("okButton");
    //adds some listeners to buttons
    addForward(Events.ON_OK, okButton, Events.ON_CLICK);
    addForward(Events.ON_CANCEL, cancelButton, Events.ON_CLICK);

And then I show the dialog window by this code:

final SetDocColumnsView dialog = UIUtils.loadComponent(SetDocColumnsView.getUrl());
dialog.configureView(columnList, hiddenIds);

I've tried to use some advice given in other threads, such as:


or call JS function inside my configureView method:

Clients.evalJavaScript("zk.Widget.$('" + dialog.table.getUuid() + "')._scrollToIndex(0);")

or keep all listitems what I need to select in a different Set and post to setSelectedItems method of Listbox, but everything is without success. Also, I've tried to debug a JS function _doScroll in Listbox.js but I don't figure out from where it has been called :(

I will be very appreciated if someone can help me with this problem.

Best regards, Roman

delete flag offensive retag edit


if your example is simple, please paste it into http://zkfiddle.org/ so that anyone can have a look directly, this increases your chances of getting a response quickly

cor3000 ( 2019-07-29 18:30:05 +0800 )edit

Yeah, I made simple zkfiddle example - http://zkfiddle.org/sample/1a44bo/1-scrollbar-in-listbox-moves-to-last-selected-item which reproduces the problem

anvibb ( 2019-07-30 21:16:58 +0800 )edit

4 Answers


answered 2019-08-01 09:12:39 +0800

hawk gravatar image hawk
2415 1 5
http://hawkphoenix.blogsp... ZK Team

Thanks for the zkfiddle example. Remove renderAll() can solve scrolling position issue. Listbox by default will render necessary Listitem for visible range, you don't need to call renderAll() which will enforce rendering all Listitems which is unnecessary for most cases. Please refer to http://zkfiddle.org/sample/1a44bo/2-scrollbar-in-listbox-moves-to-last-selected-item#source-2

link publish delete flag offensive edit
link publish delete flag offensive edit

answered 2019-07-31 21:05:33 +0800

anvibb gravatar image anvibb
3 1

updated 2019-08-01 09:01:48 +0800

hawk gravatar image hawk
2415 1 5
http://hawkphoenix.blogsp... ZK Team

Thank you for the response, hawk!

I tried to change the selection of items as you advised, but it doesn't solve my problem - when I select several items via ListModeList.setSelection, the scrollbar moves down to the last item. I made an example of that behavior in zkfiddle - http://zkfiddle.org/sample/1a44bo/1-scrollbar-in-listbox-moves-to-last-selected-item

link publish delete flag offensive edit

answered 2019-08-01 17:45:43 +0800

anvibb gravatar image anvibb
3 1

Removing renderAll() is helped!

Thank you so much!

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2019-07-29 16:02:29 +0800

Seen: 12 times

Last updated: Aug 01

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More