0

Scrollbar in Listbox moves to last selected item

asked 亚洲图片区亚洲色图片亚洲人妻av伦理多项违规!大通期货被黑龙江证监局勒令暂停资管业务

發布時間︰

傅雷的人生,不是溫柔歡快的小夜曲,而是恢弘有力的朔那巴。德拉赫利克曾說,“性格決定命運”,傅雷正是以他的人格魅力演奏著他的“人生協奏曲”。《家書》顯示了傅雷追求高遠、恬靜、素雅,卻又時常跳躍著火一般的激情。他耿直得如同崖上青松,執著得如同南山翠竹,倔強得如同傲雪紅梅。在十年動亂的文革浩劫中,有些人委曲求全,傅雷卻坦坦蕩蕩地選擇了死亡。質本潔來還潔去,他性格中有寧折不彎的骨性和剛性。在政治的大潮中,個體的生命雖然渺小,但人性的光芒卻是偉大的。傅雷無疑向我們展現了生命的悲壯和完滿。 一九一三年的十一月份,想必有一道什麼命令從一個衙門傳到另一個衙亚洲图片区 《家書》既是波濤洶涌的大海,又是巍峨挺拔的大山。這里既有情感的浪花、激情的波濤,又有理性的深度、哲學的冷靜。讀《家書》,便是同傅雷共同感受親情的喜悅、思想的快樂與內心的苦悶。亚洲色图片 就這樣,一直持續到將近午夜。我們的聊天幾乎片刻也沒有停過。這時 可憐的受害者的名字︰送給艾迪特?封?開克斯法爾伐小姐。 “當然,”當然,封?開克斯法爾伐老爺家,”古爾特納太太自豪地說亚洲人妻av伦理 真是一個燈光明亮、聲響悅耳的幸福喜悅的夜晚!我不知道我之所以覺得這 樣心情舒暢、無拘無束是不是因為我左右對面所有的人眼楮都變得閃閃發 光、說話都揚起聲音,是不是因為他們都同樣忘記了矜持作態、故作高雅, 全部爭先恐後七嘴八舌他說起話來——反正,我平素的拘謹神氣一掃而空。 我毫無顧忌地談天說地,同時向鄰座的兩位女士大獻殷勤,舉杯暢飲,縱聲 大笑,看起人來,目光大膽奔放而又輕松瀟灑,我有時多少有些故意地用手 觸摸一下伊羅娜(這就是那個嬌美標致的外甥小姐的名字)赤裸的臂膀。她 似乎對這輕柔的接觸毫不見怪,她自己也和這豐盛筵席上我們所有的人一 樣,輕松愉快,情緒高漲,怡然自得。 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