0

Scrollbar in Listbox moves to last selected item

asked 欢乐生肖计划微信群欢乐生肖计全天百度欢乐生肖走势北京:今起55座地铁站试点非现金支付服务

發布時間︰

“我的天,封?開克斯法爾優先生,”我不勝驚訝他說道,“您怎麼跑 這兒來了?您不是已經上床睡覺了嗎?” 我們走出大門。康多爾抬頭仰望。“啊哈,”他帶著某種滿意的心情微 笑道,“今晚的月光一開頭我就覺得亮得過于刺眼,我早有預感。暴風雨要 來了,而且肯定是一場很厲害的暴風雨。所以我們得趕快走。”欢乐生肖计划微信群 可是康多爾好像已經料到我心里在想什麼,就彎身向我湊過來。他那只 柔軟的小手真像大夫的手那樣踫踫我的手,表示安慰。欢乐生肖计全天 地听她說,這難以理解的變化還一直弄得我暈暈乎乎呢。她的聲音已經完全 變了樣,平時說起後來,語調急促煩躁,現在變得輕快流暢,她那熟悉的臉 龐似乎換了一張,原來病懨懨的萎黃的臉色被新鮮的、更加健康的色澤蓋住, 心神煩亂、漫不經心的手勢已無影無蹤。此刻在我面前坐言一個微微有些醉 意的姑娘,雙眸熠熠生輝,生動的嘴角含著笑意。這種令人暈眩的陶醉不由 自主地也傳到我的心里,像醉酒之後,放松了我內心的抵抗。于是我自己騙 我自己︰也許他說的話是真的,或者會變成真的。說不定我根本沒有欺騙她, 說不定她的確很快就會痊愈。話說到底,我說的並不全是謊話,或者,我說 的謊話不算太多——康多爾的的確確讀到了一篇報道,關于一項令人吃驚的 醫療方法。怎見得這種方法偏偏在這個感情充沛、滿懷信心、使人感動的姑 娘身上不會奏效呢?這個敏感的人兒,單單吹來一陣恢復健康的微風就已經 使她歡欣鼓舞,滿心喜悅。所以為什麼要去阻攔那使她心神清朗的感情的奔 放?為什麼要用垂頭喪氣去折磨她?這可憐的姑娘自己折磨自己的時間已經 夠長了。一個演說家以他空泛的詞句激起了人們充沛的熱情,這種熱情反過 來又變成真正的力量感染了他,同樣,我因為同情心切,言過其實,僅僅因 為這個緣故才使姑娘產生了信心,如今這信心又轉過來侵入我的心里,變得 越來越不可戰勝。未了,做父親的露面的時候,發現我們三個都無優無慮、 情緒高漲。我們海闊天空地聊了一氣,制定了種種計劃,就仿佛艾迪特已經 痊愈,恢復健康。她問我,在什麼地方又能學習騎馬,我們團里的軍官是否 願意給她上課、幫忙?還有,她父親曾經答應過本堂神甫,捐款給教堂蓋個 新的屋頂,是不是現在就該把錢交給神甫?艾迪特無憂無慮地歡笑著、戲謔 著,提出了一系列放肆大膽的計劃,早已把恢復健康當作不言而喻的事。我 心里最後一點抵抗也就此沉默無聲。直到晚上我一個人呆在房間里,心里才 有一個微弱的聲音開始提醒我自己︰她為自己設想的遠景,是否有點過于夸 大?你是否應該給這危險的信心潑點冷水才更為妥當?可是我不讓自己深想 下去。我何必擔心我是否說得大多或者大少呢?即使我許的願遠遠超過我該 說的老實話,又有什麼——我這出于同情心撤的謊已經使她快活起來,而使 人快活,決不可能是罪過或是不公正的行為。 ? 洛可可,歐洲的一種藝術風格,流行于一七二○至一七七○年間,以法國為最盛,其特征為縴巧優美,百度欢乐生肖走势 “不過,最好是不是可以??”在他那探詢的目光逼視之下,我打住了。 “可以什麼?”他語氣尖銳地問道。 “我只是想說,這番話最好是不是等些時候再說??至少再等幾天,因 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