0

Scrollbar in Listbox moves to last selected item

asked 亚洲在线av青娱乐亚洲领先的青青草91自拍视频网站“你是什么垃圾”之广州版:大件垃圾需预约上门服务

發布時間︰

在太太小姐們休息的房間里擺好了黑咖啡,冰鎮的上等白蘭地斟在鼓肚 子的大酒杯里源源不斷地端上來,外加品種繁多的各色燒酒,不言而喻還有 名牌粗雪茄,每根煙上都帶一個華麗考究的紙箍。大家正在談話,開克斯法 爾伐走到我的身邊,俯下身子,很審慎地問我,是願意和他們一起打紙牌, 還是寧可和小姐們閑聊。我立即表示寧願和小姐們聊天,因為,叫我冒險和 一位陸軍部的中校玩一局紙牌,我心里總感到不怎麼自在。倘若贏了,說不 定會得罪他,若是輸了,那我這個月的預算可就吹了。再說,我想起來了, 我錢包里總共不超過二十克朗。 一面以真正的激情暗下決心︰從現在起我要改變我的生活,我將停止玩那愚 蠢的塔洛克牌戲和彈子,我將斷然結束所有這些對誰也無益,而使我自己變 蠢的消遣。我寧可去多多探訪這個病人,我甚至每次都特別做些準備,以便 我總能有些好玩的、快活的事情說給兩個姑娘听。我們將一起下下棋或者用 別的什麼方式來舒舒服服地度過這段時間。我決心助人,從現在起使我有益 于別人。單單這個決心就激起我心里的一股熱情,我恨不得縱聲歌唱,由于 這種昂揚高漲的情緒,我真想干出點荒誕不經的事情來。一旦你知道,你對 別人也還有些用處,這時候你才感覺到自己生活的意義和使命。亚洲在线av 後三個字“走出去”,她強調得語氣尖銳而又斬釘截鐵,听上去像是一句威青娱乐 “喂,這是什麼?”他咕嚕了一句;“一件新的裝備!”他二話不說, 干脆從我手里把煙盒拿過去,摸一會兒,瞧一會兒,最後放在手掌心里掂掂 分量。“嘿,我覺得,”他扭過頭去對團隊軍醫說道,“這居然是真金的呢。 給,你拿去好好瞧瞧——听說令尊大人就是干這行的,那你多少也懂點行 吧。” 伴,也沒個熟人,連這小城里的鄉紳名流也一個不見。全是陌生人,素昧平 生的陌生人。似乎主要是附近一帶的地主攜同妻女,要不就是擔任公職的官 員。然而大家穿的都是便服,只有便服,除了我的軍裝,看不見別的軍服! 我的天,我這人笨口拙舌,靦腆怯生,叫我怎麼跟這些素不相識的人交談! 幸虧我的座位安排得很好。那位漂亮的外甥小姐,那位長一雙褐色眼楮、性 情奔放的姑娘就坐在我的旁邊。她似乎在點心鋪那會兒就注意到了我向她投 去的艷羨贊賞的目光,因為她對我友好地微笑,好像我是個老朋友。她那雙 眸子像兩粒咖啡豆,的確,她一笑就發出咯咯咯的聲音,像炒豆子的聲音一 樣。在她濃密的美發下面長著一對小巧迷人的耳朵,薄得幾乎透光。我心里 暗想,這可像是長在一片苔蘚上面的兩株玫瑰紅的櫻草啊。她裸露著柔軟細 嫩的雙臂;摸上去一定像剝了皮的桃子一樣潤滑。亚洲领先的青青草91自拍视频网站 的兩層樓房,佔面積很大。樓房是以古老的奧地利的方式,涂上所謂的肖恩 布魯恩?,配上綠色的百葉窗。隔著一個內院是幾座比較低矮,顯然用作僕役 住房、管理處和馬廄的樓房,一直向一座宏大的花園伸展過去,我第一次夜 訪絲毫沒有看到這座花園。現在透過那些所謂的牛眼窗,也就是砌在高大石 牆里的那些橢圓形空洞,我才發現,這座開克斯法爾伐府邸,根本不像我看 到室內的裝潢陳設之後所設想的那樣,是一座摩登的別墅,而是一座地地道 道的鄉間地主的宅第,一幢舊式的貴族府邸,我在波希米亞參加軍事演習時 騎馬走過,有時看見過這類府邸。只有那座古里古怪的四方形塔樓顯得有些 刺眼,那形狀使人有點想起意大利的鐘樓,很不協調地矗立在那里,也許是 多年前曾經坐落在這里的一座宮殿的殘余部分。我事後想起,從練兵場上曾 多次看見過這座奇怪的塔樓,當然我一直以為,這不知是哪個村的教堂鐘樓。 現在我才注意到,塔樓上通常都有的那個球形塔頂不見了,古怪的六面形塔 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