0

Scrollbar in Listbox moves to last selected item

asked 狠狠撸在线图片俺去啦影音先锋播放第4色 第四色上海上港2球胜北京国安 首夺中国足协超级杯冠军

發布時間︰

她的愛撫使我厭倦,也不是她那縴秀的手指這樣溫暖的來回移動,這輕柔羞 怯的接觸使我難受。折磨我的,是我的手這樣僵死地擱在那里,仿佛這只手 不屬于我,而撫愛這只手的那個人也並不屬于我的生活。就像在半醒半睡的 狀態中听見教堂里鐘聲齊鳴,我知道,我必須作出一種回答——要麼抵御這 種愛撫,要麼我也以愛撫相報。但是我既無力抵御,也無力以愛撫回報︰我 心里只是急著想結束這場危險的游戲,所以我小心翼翼地繃緊我的肌肉。我 開始慢慢地,慢慢地,非常緩慢地把我的手從她兩手輕柔的包圍之中解脫出 來,像我希望的那樣,不被覺察地解脫出來。但是這敏感的姑娘立刻感覺到 之際作出的這一禮貌的姿態把我徹底打倒了。我突然又感到那股溫暖的泉 水,那股熾熱的洶涌的洪流在我心頭漸漸升起,使我眼楮熱辣辣的,同時我 又感到我的心軟了,渾身軟弱無力;我覺得我又一次被同情心所壓倒。我總 不能就這樣放他走,這個老人是來把他的孩子,他在這世界上惟一的命根子 獻給我的,我不能讓他走向絕望,走向死亡。我總不能把生命從他身上奪走。 我必須再說幾句,說些使人安慰、使人平靜、使人寬心的話才是。于是我急 急忙忙地快步追了過去。狠狠撸在线图片 我太太那里去了。” 然而他並沒有站起來。我感覺到,他心里又開始有些猶豫。 “還有件事,”他輕聲地補充道,“我們當大夫的不得不也老是想著難俺去啦影音先锋播放 “不過,巴林凱,正因為這個緣故我才要遠走高飛,不論到哪兒去,那 我看了一眼表。六點三刻,我乘的快車要到十點以後才開。所以時間很 充裕,我需要向他說明的事情也不多,我只是告訴他,我本人不干這事了。 可是他住在哪兒呢?他有沒有跟我說過,還是說過我忘了?話說回來,作為 一個開業行醫的醫生,電話簿里準會有他的名字,那麼趕快到對面電話亭去 翻翻電話簿!Be??Bi??Bu??Ca??Co??好,所有姓康多爾?的都在這 兒了,康多爾、安東,商人??康多爾醫生、艾默里希,開業醫生,第八區,第4色 第四色 弗洛里阿尼胡同九十七號。整個這一頁再也沒有第二個醫生了——那麼這個 想必就是他。我跑出電話亭時還把地址重復記了兩三遍——我身邊沒帶鉛 筆,我剛才極度匆忙,什麼都忘了帶了——我馬上把地址告訴最近的一輛馬 車的車夫。裝著橡皮車輪的馬車向前馳去,又迅速,又舒服。與此同時,我 已經想好了我的計劃。一上來就說,話語務必簡短扼要,口氣務必斬釘截鐵。 千萬不要顯得我似乎還搖擺不定。根本不讓他產生這種估計,認為我大概是 因為開克斯怯爾伐一家而悄悄逃遁的,而是從一開頭就把辭職一事當作既成 事實。所有這一切都已經籌劃了好幾個月,可是直到今天我才得到荷蘭的這 個出色的職位。倘若他盡管這樣還東問西問,沒完沒了,我就拒絕回答,什 麼也不多說!話說到底,他自己也沒有把所有的事都說給我听啊。我老是照 顧別人這個那個,現在可不能繼續這麼辦了。 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