0

Scrollbar in Listbox moves to last selected item

asked 欢乐生肖技巧稳赚方法贵州快3三同号推荐贵州快3下期推荐号码贵州茅台股价创历史新高 距离破千仅一步之遥

發布時間︰

—我不想用夸張的言辭來表達我的思想,說什麼,我們的朋友突然天良發現。 然而自從那支鋼筆一劃,這兩個對手之間的外在形勢便發生了決定性的變 化。請您考慮一下︰整整兩天兩夜,卡尼茲是作為買主在跟這個作為賣主的 可憐姑娘進行斗爭。她曾經是他的敵人,他必須從戰略上把她包圍起來,讓 她陷進圈套,迫使她繳械投降;可是現在這場財政軍事上的戰役已經結束。 拿破侖卡尼茲已經凱旋,全面勝利,這一來,這個走在他的身邊、穿過鯨魚 胡同的衣衫簡樸、文雅嫻靜的姑娘,就不再是他的對手,不再是他的敵人。 那麼——盡管這話听起來很奇怪,其實在他迅速得勝的這一瞬間,使得我們 的朋友感到特別壓抑的乃是︰他的受害者讓他過于輕易地取得了勝利。因為, 如果你對一個人做出一點不公道的事情,那麼,要是你能找出材料證明,或 者自以為有材料證明,此人某件小事做得不對或者做法有失公道,你就會很 奇怪地感到心安理得。只要能怪受騙者有錯,至少有個小小的過錯,你的良 心總會感到平安。但是卡尼茲對這個受害者實在無可指責,一點可指責的地 方也沒有。她是捆綁了自己的雙手向他投降的,而同時還不斷地用她那渾然 無知的蔚藍色的眼楮不勝感激地望著他。你叫他現在事後跟她說什麼呢?莫 非還祝賀她出賣了莊園,這豈不就是祝賀她蒙受損失嗎?他心里覺得越來越 不自在。他迅速地考慮了一下︰我送她到旅館去;然後就完事大吉,一切全 都過去了。 “好,咱們開門見山吧——我得趕快,要不然他們在城外得到風聲,會 說我們兩個狼狽為奸,在這兒搗鬼,我一下火車他們的司機就馬上想把我送 到城外去。把這司機打發走,就夠麻煩的了。咱們言歸正傳吧,這樣您可以 知道,發生了什麼事情!欢乐生肖技巧稳赚方法 “可是這時,她又出現在門口,她的眼楮淚痕未干,情緒無比激動。她 的肩膀瑟瑟直抖。她走到桌子跟前,不得不用雙手緊握著椅子扶手,然後重 新坐下。她輕聲呼吸,眼楮抬也不抬︰贵州快3三同号推荐 ? 洛可可,歐洲的一種藝術風格,流行于一七二○至一七七○年間,以法國為最盛,其特征為縴巧優美,贵州快3下期推荐号码 “‘您說,多少?’ “卡尼茲的兩個耳朵突然熱血上涌,嗡嗡直響。她猛然轉過身去看他, 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