0

Scrollbar in Listbox moves to last selected item

asked 情色五月天小说情色五月天网站婷婷情色五月天Gartner:华为蚕食苹果三星份额 用国产手机有自豪…

發布時間︰

“舒服的日子——您想得倒美!七,八、九這三個月對于騎兵會是舒服 的日子!您難道不知道,這正好是對騎兵百般折磨的旺季啊!先是準備軍事 演習,然後向波斯尼亞或者加利西亞來回調防,接著舉行演習和盛大的閱兵 式!軍官們激動不已,士兵們疲于奔命,從早到晚都是勤務,而且要一絲不 苟。這場熱鬧戲一直得拖到九月下旬。” 出什麼事啦?” “沒有,沒出事,”我只有結結巴巴他說幾句話的力氣,我一心只想快情色五月天小说 “這我不在乎。” 我說這句話的態度想必非常激烈,因為巴林凱先不勝好奇地看了我一情色五月天网站 —我只求一點︰只求你原諒,完全忘記已經發生的一切,忘記我跟你說的話, 我所暴露的感情。只請你給我這一個慰藉,只請你給我這一個小小的可憐的 確切信息!請你馬上告訴我,你只要說一句話,我就已經滿足了。你只要說, 你並不討厭我,你還會到我們家里來,就仿佛什麼事也沒有發生似的︰你想 象不出我是多麼擔心會失去你。自從房門在你身後關上之時起,我也不知道 為什麼,有一種致命的恐懼折磨著我,生伯這是最後一次見面。在我放開你 的那一刻,你的臉色是多麼蒼白,眼楮里含著多麼大的驚恐,我雖然身在熊 熊烈焰之中,心里卻突然變得冰冷了。我知道——僕人已經告訴我了——你 馬上就逃出了我們家,一下子你就不見了,還有你的佩刀,你的軍帽。他徒 然去找你,在我屋里找,到處都找。于是我知道,你逃走了。你逃避我,就 像逃避麻風病,就像逃避黑死病。可是不,親愛的,我不是責備你,我是理 解你的啊!我只要看見我那像兩條木棍似的腿,自己都會嚇一大跳。惟有我, 恰好只有我知道,我在煩惱焦灼的時候,變得多麼凶惡,多麼怪僻,多麼折 磨人,多麼叫人難以忍受。恰好只有我最能理解,人家看見我會嚇一跳—— 啊,我非常理解,既然人家看見我都會嚇得逃走,那麼這樣一個怪物如果去 襲擊別人,人家一定會嚇得退避三舍。然而我還是要懇求你原諒我,因為如 果沒有你,我就既無白晝也無黑夜,只有一片絕望。請你送張紙條給我,一 張小小的紙條,隨手寫上幾筆,或者給我一張白紙,一朵花,不管什麼樣的 表示都行!只要給我一點什麼東西,我從中看出,你並不擯斥我,你並不討 厭我。請你想一想,過幾天我就動身走了,一去就是幾個月,再過八天,十 天,你受的折磨就到頭了。盡管接著我將開始受到成千倍的折磨,忍受幾個 星期、幾十月的不得不失去你的痛苦,可是我並不去想這些,我只是思念你, 就像一直以來那樣思念你,我只想你!——八天之後你就解脫了——所以請 你再來一次吧,來之前給我捎句話,給我一個表示!只要我不知道你是否已 經原諒我了,那我就一刻也不能思想,不能呼吸,不能感覺。倘若你拒絕給 我愛你的權利,那我不願意再活下去,也不可能再活下去了。” 婷婷情色五月天 “不過現在得快點兒!你想想,巴林凱突然闖來了,從荷蘭還是從美國, 天知道是從哪兒來的。全團的軍官和服役一年的志願兵,今天晚上他都請了。 上校要來,還有少校,今天可是盛大的宴會,設在紅獅酒家,時間是八點半。 幸虧我們把你逮著了,要是你溜了,老頭可要大發雷霆呢!你也知道,他喜 歡巴林凱喜歡得要命。巴林凱一來,大家都得列隊歡迎。” 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