0

Scrollbar in Listbox moves to last selected item

asked 青娱乐一极品视频盛宴青娱乐最新官网在线看青娱乐青娱乐视频分类女司机高速抛锚行车道停车8分钟 还淡定打电话

發布時間︰

請你相信一個伙伴,他自己就是個過來人︰如果一個人猛然從上層滑到下層, 從他騎的軍官的高頭大馬一直跌進爛泥里,這可絕不是等閑小事啊。??告 訴你這句話的人,曾經在這間破破爛爛的小房間里從中午十二點一直坐到天 黑,他當時也正好對他自己這麼說︰‘這我不在乎。’我是在十一點半前幾 分辦完的離職手續。我不願再到軍官餐廳去跟其他人坐在一起,而穿上便服 我又不敢在大白天走上大街。于是我就要了這個房間,——現在你明白了吧, 為什麼我總是偏偏要這個房間——我在這兒一直等到大黑,免得有人滿懷同 情地眯著眼楮看巴林凱如何穿了一件窮酸的灰色上衣,頭戴一頂圓形呢帽悄 悄溜走。那兒,那扇窗前,我正好就站在那扇窗前,再一次探出頭去看看下 面來來往往的行人。伙伴們在那兒走路,每個都穿著軍裝,身體挺得筆直, 神態無拘無束,個個都像小天神,每個都知道,自己是何等人物,屬于哪個 階層。這時我才明白,我在這世界上微如芥未。我仿佛覺得,連同軍裝把我 自己的皮也剝了下來。你現在當然會這樣想︰胡說八道!這塊衣料是藍的, 另一塊是黑的或者灰的,一個人散步的時候手里握著一把佩刀還是一把雨 傘,還不都一樣!可是直到今天,我所有的骨頭縫里還都感到我當時所受的 震動。那天夜里,我悄悄地溜出去,直奔火車站,在拐角的地方有兩名輕騎 兵從我身邊走過,誰也不向我敬禮。然後我自己把我的小皮箱提進三等車廂, 坐在渾身汗濕的農家婦女和工人當中??是的,我知道,這一切都很愚蠢, 而且很不公平。我們所謂的軍官階層的榮譽純粹是狗屎??可是服役八年, 士官學校四年,這種東西已經深入血液!起先我覺得自己像個殘廢,或者像 個臉上長了膿瘡的人。願天主保佑你,別讓你去親自經歷這種事情!就是給 我全世界所有的金錢,我也不願重新經歷一遍當時我從這里溜出去,繞過每 一盞路燈一直走到火車站去的情景。而這一切還僅僅是好戲剛開場呢。” 我一句話不說,向他伸出手去。 “那麼,我想,一切又都安全妥當了,我們現在可以安安心心地到隔壁青娱乐一极品视频盛宴 馬車停了。車夫沒有弄錯嗎,抑或是我在忙亂之中把地址說錯了?這個 康多爾難道真的注得這麼寒傖?單單從開克斯法爾伐家里他掙的錢大概就數 目驚人,沒有一個有地位的醫生會住在這麼一個窩棚里的。可是不對,他是 往在這里,門廊里掛著一個牌子︰“艾默里希?康多爾大夫,二院四樓,門 診時間兩點至四點”。兩點至四點,現在都快七點了。不管怎麼著,他是非 見我不可的。我趕快把馬車打發走,穿過院子,院子里鋪著石塊,參差不齊。 螺旋形樓梯寒傖已極,梯階都踩得沒了稜角,四壁斑駁,涂得亂七八糟,從 蹩腳的廚房和沒有關嚴的廁所里,傳來陣陣臭氣。穿著骯髒睡衣的女人在走 廊里閑談,用懷疑的眼光盯著我這個騎兵軍官,而我在朦朧夜色中把刺馬針 踩得鏗鏘直響,從她們身旁走過,顯得有些尷尬。青娱乐最新官网在线看 開克斯法爾伐把“他”字一說出口,我頓時感到渾身冰涼。他向我這樣 暗示他女兒的感情,這還是第一次。很久以來我就已經發現,他顯然在回避 我,是啊,他簡直不敢正眼看我,而他先前是多麼溫柔多麼急切地爭取我啊! 可是我知道,使他和我疏遠的原因是羞愧。眼睜睜地看著自己的女兒在追求 一個男子,而此人卻從她身邊逃走,這對于這位老人想必是十分可怕的事情。 她內心的秘密自白想必使老人受盡了折磨,而她那毫不掩飾的欲望想必使他 無地自容。他和我一樣,也失去了落落大方的態度。誰要是掩飾什麼或者不 得不掩飾什麼,他的目光就不會坦然直率、自由無羈。 說罷他很快改變嗓音,接著大聲地說了幾句,為了讓隔開兩個房間的人 也能听到︰青娱乐青娱乐视频分类 她摸索著走近幾步,我看到這張憤怒激動的臉負疚似地直往後退。在這 張臉上,那雙睜得大大的眼楮突然閃閃發光,活像兩枚照得通亮的白色圓球。 “我說過了,您走吧。您走!讓他也像別人一樣地吃飯、睡覺吧!你們 大家別死死地抓住他!夜里也好,早晨也好,一整天總是病人,叫他為所有 這些病人賣命,為他們白白地賣命!因為你們感覺到,他性格軟弱,你們大 家都纏著他,只纏著他一個人??啊,你們大家都是粗野的!腦子里只有你 們的疾病,只有你們的憂慮,除此之外你們什麼也不知道!不過,我不能容 忍這個,我不允許這樣的事情發生。您走吧,我跟您說過了,您馬上就走! 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