0

Scrollbar in Listbox moves to last selected item

asked 人人摸超碰人人最新上线视频超碰97免费人妻NASA警告波音和SpaceX:载人航天系统存安全隐患

發布時間︰

身去,在她耳邊低聲說了幾句,可是姑娘顯然激動起來,她火氣很大地向她 的女伴嚷道︰“不嘛,約瑟夫只要把我扶起來就行了。我要自己走。” 人人摸 “請相信我,要是我說,幾年來,我為這枚瑪利亞?特利莎勛章受的罪比什麼都厲害,這可不 是說漂亮話,這枚勛章不大符合我個人的口味,我嫌它太顯眼。不過,說實話,我在戰場上得到這枚 勛章,把它掛在胸前的時候,起先當然感到渾身熱血沸騰。我畢竟是從小受軍人教育長大成人的,在 士官學校听人說起這種勛章就像在听一則傳奇。這種勛章每次戰爭也許只有十幾個人能得到,所以的 確像是一顆福星從天而降。不錯,對于一個二十八歲的小伙子來說,這當然是件了不起的事情。你一 下子就站在全線官兵前面,大家都側目而視,陡然間,你胸前有個東西耀眼生輝,活像個小太陽.那可 望而不可即的皇帝陛下和你握手表示祝賀。可是您瞧,這種褒獎只有在我們軍人世界才有意義,才算 數,等到戰爭一結束,還一輩子作為一個蓋了戳的英雄走來走去,未免可笑,因為你不過有那麼一次 的確很勇敢地行動了二十分鐘之久——也許並不比上萬個別的軍人更勇敢,你只不過比他們運氣蚜, 讓人看見了,說不定還有更令人吃驚的事,那就是你活著回來了。人們到處盯著看這塊小小的金屬片, 然後滿懷敬畏之情抬起眼楮來瞅我,這樣過了一年,我可真的受夠啦,我不願再做一個活動的紀念碑 到處游蕩。這樣沒完沒了地引人注目實在叫我冒火,這也是為什麼戰爭一結束我馬上解甲歸田的決定 性原因之一。”超碰人人最新上线视频 半個鐘頭到城外去。根據感情交叉反應的秘密法則,一個發火的人不自覺地 總要把他的火氣發泄到不相干的人身上,總像一個彈子球自己受到撞擊之後 總要傳到別的彈子上去。同樣,我的惡劣情緒不是針對約茨西和費倫茨,卻 去怪在汗克斯法爾伐一家身上。讓他們就等我一回吧!我叫他們看看,我不 是用禮品和殷勤款待所能收買的,我不會像按摩師或者體操教師那樣按鐘點 準時來到的。千萬別創造出先入為主的先例,養成習慣便成了義務,我可不 願把自己拴在某個義務上。我這愚蠢的倔強脾氣使我在咖啡館里坐了三個半 鐘頭,白白浪費了時間,一直呆到七點半,僅僅為了說服我自己並且證明我 是完全來去自由的,我愛什麼時候來去由我自己決定,開克斯法爾伐家的好 吃好喝和高級雪茄對我全都可有可無。 “您要是知道這孩子從前是什麼樣子就好了!整天從樓梯上跑上跑下, 上樓下樓,進屋出屋總是快跑,像陣風一樣,我們看了都心驚肉跳。十一歲 就騎著她的小馬在草地上飛奔疾馳,誰也趕不上她。她是這樣大膽,這樣奔 放,手腳是這樣輕捷靈敏。我的亡妻和我常常心里害怕。我們總有這樣一種 感覺,她只消把雙臂伸開,就可以凌空飛起。??可是偏偏是她遭到這樣的 不幸,偏偏是她??”超碰97免费人妻 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