0

Scrollbar in Listbox moves to last selected item

asked 偷窥自拍亚洲自拍偷拍自拍图片华为发布面向2025十大趋势:全球58%人口将享有5G网络

發布時間︰

了。但願您的迫不及待能比我的沉穩耐心取得更好的效果。所以讓我們再給 這可憐的姑娘幾個星期充滿信心的時間吧!倘若這段時間里我們的確使她的 病情大大好轉,那麼是您幫助了她,而不是我。就這麼辦吧!現在我非走不 可了。他們還在城外等我呢。” “嘿,您對這事怎麼看?您怎麼這麼傻坐著,對不起,這麼心驚肉跳地 坐著?您為什麼一句話也不說?難道您一點也不為我感到高興?”偷窥自拍 我頭腦里一時糊涂,我是不是喝醉了?我是在睜著眼楮做夢?我是不是 神志不清了?我剛才在解開上裝的時候,不是還清清楚楚地感覺到胸口的口 袋里信紙在沙沙作響嗎?難道我已經心慌意亂到這種程度,剛把信取了出 來,一分鐘之後就不知道擱在哪兒了?我把手伸進口袋,瞧,可不就是這麼 回事,不可能是別的情況啊——這封信依然安安生生地裝在口袋里呢。現在 我才明白發生了什麼事情。現在我才頭腦完全清醒過來。桌上的這封信想必 是新來的信,是第二封,另外一封,後來寄到的信,忠厚老實的庫斯馬辦事 周到,特意把信放在熱水瓶旁邊,我一回來就可以馬上看到。亚洲自拍 逼得您說的。他那不要命的執拗勁,的確令人招架不住。是的,這我知道, 我知道,您純粹是出于同情心,可以說,是出于最正派最善良的動機而心軟 的。但是,我想,我有一次曾經警告過您,同情心這玩意兒,可是他媽的一 件兩面雙刃的東西。誰要是不會擺弄,趁早撤手,尤其要穩住自己的心。同 情就跟嗎啡一樣,只在剛開頭的時候對病人是行善,是靈藥,是幫助,可是 如果你不會掌握分寸,劑量不當,不及時停藥,就會變成凶險的毒藥。最初 打上幾針,叫人舒服,使人平靜,減輕痛苦。然而極其不幸的是,人的機體 和人的靈魂都擁有一種可怕的適應力,人的神經要求越來越多的嗎啡,同樣, 人的感情也要求越來越多的同情。臨了,竟多到無法饜足的程度。遲早總有 一天,不是在這兒,就是在那兒,會不可避免地出現你非說‘不行’不可的 瞬間,那時候你就管不了,因為你最後的這次拒絕,人家究竟是不是會比你 從來沒有幫助過他更加恨你。是的,親愛的少尉先生,做人得好好控制自己 偷拍自拍图片 可是一陣恐怖的心情一下子攫住了我。這種粗魯的笑聲像一只利爪緊緊 地抓住了我的心,因為如果有一個人正在呻吟,正在忍受難以估量的痛苦, 我們怎麼能這樣放聲大笑?有人正在淪于毀滅,我們怎麼能用這些惡俗的玩 笑來互相逗趣,互相揶揄?我知道,等馮德拉斯切克的廢話一完,馬上就要 開懷暢飲,高聲談笑,消磨時光。大伙將放聲歌唱,歌唱《拉恩河上的女店 主》里最新的幾段歌詞,並且大講笑話。大家就笑啊,笑啊,笑個不停。驀 然間,這一張張閃閃發亮的好心善意的臉我再也看不下去了。她不是在信上 寫了,只要我送張紙條去,只要我送一句話去就行了嗎?我是不是到電話機 那兒去給城外打個電話?我可不能讓別人這樣等啊!我得跟她說點什麼,我 得?? 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:

<zk>
<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"
        use="com.otr.sufd.zkossforms.table.SetDocColumnsView"
        closable="true" border="normal" title="Customize columns" ctrlKeys="" height="400px" width="300px">
    <borderlayout width="100%" height="100%">
        <center>
            <listbox id="table" checkmark="true" vflex="true" fixedLayout="true" multiple="true" width="100%">
                <listhead>
                    <listheader align="left">Column title</listheader>
                </listhead>
            </listbox>
        </center>

        <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"/>
            </toolbar>
        </south>
    </borderlayout>
</window>

</zk>

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

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

    final ListModelList tableModel = new ListModelList(columns);
    tableModel.setMultiple(true);
    table.setModel(tableModel);
    table.renderAll();
    for (int i = 0; i < columns.size(); i++) {
        final HeaderElement column = columns.get(i);
        if (column != null) {
            final Listitem listitem = table.getItemAtIndex(i);
            listitem.setLabel(column.getLabel());
            final String columnId = column.getId();
            listitem.setValue(columnId);
            listitem.setSelected(!hiddenIds.contains(columnId));
        }
    }
}
@Override
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);
    okButton.setFocus(true);
}

And then I show the dialog window by this code:

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

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

Clients.scrollIntoView(table.getItemAtIndex(0))

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

Comments

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

0

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
0
link publish delete flag offensive edit
0

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
0

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

Follow
1 follower

RSS

Stats

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

Seen: 12 times

Last updated: Aug 01

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