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