0

Scrollbar in Listbox moves to last selected item

asked 国产草莓视频免费播放青青青草免费超碰久久视频这里只精品10英军有了首位女中将 曾在伊拉克服役任工程师(图)

發布時間︰

然而伊羅娜悲哀地搖了搖頭。“不,親愛的朋友,您不要騙您自己。在 艾迪特身上這事可是當真的,當真極了,甚至一天比一天變得更加危險?? 不,親愛的朋友,我不能把這麼嚴重的事情,突然之間,說得好像對您輕松 得很似的。唉,要是您能想象出來,這府邪里發生過一些什麼事就好了??国产草莓视频免费播放 勤務兵已經把大門打開,團部的軍官已經走進大廳,腳上的刺馬針踩得青青青草免费超碰 我毫不羞慚地承認,當我做夢似的息象出這一切的時候,心里有一種奇 怪的自我滿足的情緒。我們無論做什麼事情,虛榮心總是最強大的推動力之 一。天性軟弱的人特別抵御不住這樣的誘惑︰做某件事情,對外給人以有力 量、有勇氣、堅決果斷的印象。我現在第一次有機會向伙伴們證明,我是一 個有自尊心的人,我是一個十足的男子漢!于是我越寫越快,我自己認為, 用我的嘴唇輕輕地、草草了事地踫了一下她的額頭。我故意沒有怎麼觸及她 的皮膚,只感到近處襲來一陣她秀發的模糊的幽香。久久视频这里只精品10 已經陷進了一張什麼樣的羅網(別人從一開頭就已經看清了網上的每一 根線,每一個網眼),——這府邪里所有的人想必在旁邊看得清清楚楚,我 如何在這場荒唐的感情的捉迷藏當中,到處亂摸亂踫,直到她終于用暴力從 我的眼前撕去那條繃帶為止。可是就像只要燃起一點點亮光,就足以把屋里 十幾樣東西同時照亮,所以現在,——可惜太晚了!太晚了!這幾個星期發 生的不計其數的許多細節事後我都明白了,使我羞愧得無地自容。現在我才 心里一亮,為什麼我每次老氣橫秋地叫她“孩子”,她總氣得要命,因為她 恰好不願意在我面前當孩子,而是熱切期望人家把她看作女人,當作戀人。 現在我才明白,為什麼有時候她的跛足顯然使我深為震驚時,她的嘴唇會不 安地顫抖不已,為什麼她對我的同情深惡痛絕——顯然,她身上女性的本能 清楚地認識到,同情是一種不冷不熱的兄弟姐妹之間的感情,只不過是真正 的愛情的一種可悲的代用品。這可憐的姑娘想必苦苦地只等一句話,一個信 號,表示我已心領神會,可是這句話、這個信號總是遲遲不來,她想必在我 落落大方地高談闊論的時候備受折磨,她是在焦躁難忍的火紅烙鐵上受熬 煎,心靈一顫一顫地等啊等啊,等待第一個溫情脈脈的手勢,或者至少等我 終于發現了她的激情。而我,我什麼也沒說,什麼也沒做。可是我又不遠遠 走開,依然每天照來不誤,從而不斷地加強了她的信念,同時我的心靈又反 應遲鈍,使她困惑迷惘——因此,最後她的神經終于撕裂,她干脆把我抓去 當做戰利品,這是完全可以理解的了! 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