Scrollbar in Listbox moves to last selected item

asked 九九在线精品视频久久久久re热手机在线看99久久免费热在线精品安信国际:20只潜在新晋港股通标的一览中烟香港在列


一九六二年四月一日 像你這樣的年齡與經驗,隨時隨地吸收別人的意見非常重要。經常請教前輩更是必需。你敏感得很,準會很快領會到那位前輩的特色與專長,盡量汲取不到汲取完了決不輕易調換老師。九九在线精品视频久久 久久re热手机在线看 ……最近一個月來,陸陸續續打了幾件毛線衣,另外買了一件小斗篷,小被頭,作為做祖母的一番心意,不日就要去寄了,怕你們都不在,還是由你岳父轉的。我也不知對你們合適否?衣服尺寸都是望主做的,好在穿絨線衣時要九十月才用得著,將來需要,不妨來信告知,我可以經常代你們打。孩子的名字,我們倆常在商量,因為今年是龍年,就根據龍的特性來想,前兩星期去新城隍廟看看花草,有一種叫凌宵的花,據周朝幀先生說,此花開在初夏,色帶火黃,非常艷麗,我們就買了一棵回來,後來我靈機一動,“凌霄”作為男孩子的名字不是很好麼?聲音也好听,意義有高翔的意思;傳說龍在雲中,那末女孩于叫“凌雲”再貼切沒有了,我們就這麼決定了。再有我們姓傅的,三代都是單名(你祖父叫傅鵬,父雷,你聰),來一個雙名也挺有意思,你覺得怎樣? 99久久免费热在线精品 吃過晚飯,又讀了一遍(第三遍)來信。你自己說寫得亂七八糟,其實並不。你有的是真情實感,真正和真實的觀察,分析,判斷,便是雜亂也亂不到哪里去。中文也並未退步︰你爸爸最挑剔文字,我說不退步你可相信是真的不退步。而你那股熱情和正義感不知不覺洋溢于字里行間,教我看了安慰,興奮……有些段落好像是我十幾年來和你說的話的回聲……你沒有辜負園丁! 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