Scrollbar in Listbox moves to last selected item

asked 哥哥干官网哥哥去官网哥哥日光顾着猜测美联储降息 市场却忽略了这个大麻烦!


汽車流通協會副秘書長羅磊稱,可能會有一段時期某些產品會斷貨,等待周期會加長。但是很長一段時間以來,進口車都處于超庫存狀態,庫存系數一直超過兩個月。“這次事故可能會使得經銷商庫存壓力得到一定緩解,供需關系會有一定變化。但從目前了解的信息來看,進口車價格不會發生太大變化,和過百萬輛的進口車銷量相比,此次受損的車輛量並不大。” ——在手段上,更加機動靈活。哥哥干官网 根據愛爾蘭作家科爾姆?托賓的小說《布魯克林》改編的同名電影,入圍了最佳影片、最佳女主角、最佳改編劇本獎等三項提名。原著小說曾入圍2009年的英國布克獎,中文版于2010年由99讀書人引進,上海文藝出版社出版,講述了一個關于漂泊與回歸、摯愛與痛失、個人的自由與責任的故事。哥哥去官网 數據顯示,7月新能源汽車生產19307輛,銷售16884輛,同比分別增長2.2倍和3.3倍。其中純電動汽車產銷分別完成11252輛和 8970輛,同比分別增長1.7倍和3.3倍;插電式混合動力汽車產銷分別完成8055輛和7914輛,同比均增長3.4倍。1~7月新能源汽車生產 95530輛,銷售89549輛,同比分別增長2.5倍和2.6倍。其中純電動汽車產銷分別完成60294輛和55180輛,同比分別增長2.7倍和3 倍;插電式混合動力汽車產銷分別完成35236輛和34369輛,同比增長2.2倍和2.1倍。 “意見對‘既重服務、又重管理’提出新的要求,這就要求老干部工作者不僅要當好‘服務員’,照顧好離退休干部的晚年生活,還要當好‘宣傳員’和‘引導員’,使他們在思想上政治上行動上與以習近平同志為總書記的黨中央保持高度一致。”中航工業離退休人員管理局局長高軍說。哥哥日 第四,“現場新聞”還使受眾能夠參與新聞的生產。新版新華社客戶端既是展示平台,也是采集終端。通過一台手機,經過認證的用戶能夠參與發起現場視頻等多媒體直播,經編輯部加工後形成新聞產品。在新聞生產流程中引入受眾參與,將大大拓展新華社的新聞采集網絡。 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