0

Scrollbar in Listbox moves to last selected item

asked 2018一本道av手机在线一级a做爰片大香蕉大和:华润燃气重申优于大市评级 升目标价至43港元

發布時間︰

我當時是怎麼回到城里去的,這事我永遠也搞不清楚了。我只知道,我 當時走得很快,隨著我的脈搏的每一下跳動,只有一個念頭在一再重復︰快 走!快走!快離開這座府邸,脫離這個圈套。快逃,快跑,跑得無影無蹤! 永遠不要再踏進這座別墅,永遠不要再看見這些人,根本什麼人也不要再見! 躲起來,誰也不讓看見,對誰也不再承擔義務,再也不卷進任何圈套里去! 我知道,我當時還試圖繼續往下想︰辭去軍職,到什麼地方去尋些錢來,然 後逃到異國他鄉,遠走高飛,這荒謬的要求再也夠不著我;然而這一切與其 說是經過深思熟慮的清清楚楚的思想,毋寧說是朦朧模糊的夢想,因為在這 過程中我的太陽穴里只有一句話像鐵錘似地敲個不停,走,走,走,快走吧! 後來從我那布滿灰塵的鞋和褲子上被薊草劃破的口子看出,我大概在草 地、田野、馬路上亂跑了一陣。反正等我最後走上大路的時候,太陽已經偏 西,落到了屋頂後面。有人猝不及防地從背後拍拍我的肩膀,我的確像個夢2018一本道av手机在线 作給我做?听說你們不是開了好幾家大商行嗎。” 巴林凱沉吟了一會兒,然後深表同情地嘆了口氣。 “可憐的家伙,他們想必把你整得夠嗆——別害怕,我不盤問你,我自一级a做爰片 叮當直響。我們大家騰地一下從座位上跳起,站著行了一個“注目禮”。上 校在巴林凱的右邊坐下,巴林凱的左邊則坐著軍餃最高的少校,席上立刻活 躍起來,盤碟湯匙,叮叮當當,大家又說又喝,七嘴八舌,亂成一團。只有 我一個人神不守舍地坐在這一群輕松愉快的伙伴當中,一而再、再而三地摸 著我上衣的某個地方,那兒有什麼東西在砰砰直敲,不斷跳動,宛如我的第 二顆心。每次我伸手去模,隔著柔韌的呢子我都感到那封信在嘩嘩剝剝地響, 活像一蓬扇旺了的火。是的,信在那兒,就在緊貼著我胸膛的地方輕輕蠕動, 宛如一個活物。別人安安穩穩地聊天,津津有味地咀嚼,而我什麼也想不起 來,只想著這封信,只想著寫這封信的人所處的絕望的困苦境地。 己一眼就看出幾分了。如果真的到了這個地步,那麼規勸、攔阻全都已經無 濟于事。當朋友的就只好挺身而出。一切都會辦得妥妥帖帖,對此,用不著 再特別擔保。只不過有一點,霍夫米勒,你明理曉事,總不會幻想,你在我 們那兒辦事,我會讓你一上來就地位顯赫,步步高升。這樣的事情在任何一 個正經的企業里都沒有的。如果來了個人平白無故地就跳過別人的肩膀躥上 去,只會使別人心生憎恨。你必須從最底層干起,說不定先得坐在賬房里干 幾個月愚蠢無聊的抄抄寫寫的活,然後才能把你派到海外的種植園去或者想 方設法變點花樣出來。反正,我已經說過了,我會張羅這件事的。明天我妻 子和我就動身,在巴黎逛那麼八到十天,然後我們就到勒阿弗爾和安特衛普 去幾天,視察幾家代理處。不過最多三星期我們就回來,一到鹿特丹我就寫 信給你。別擔心——我忘不了!你對巴林凱盡可放心。”大香蕉 “我知道,”我說道,“我很感謝你。” 不過巴林凱大約從我這兩句話後面听出了微微的失望(他自己可能經歷 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