0

Scrollbar in Listbox moves to last selected item

asked 福利在线国产在线精品亚洲超碰在线视频上海一公交车行驶途中轮胎突然飞出 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