0

Scrollbar in Listbox moves to last selected item

asked 哥哥坏哥哥坏妹妹爱哥哥爱色阁百度发布第四季度财报 盘后股价上涨3.38%

發布時間︰

但你成長以後和我們相處的日子太少,還有一個方面你沒有懂得爸爸。他有極delicate[細致]極complex[復雜]的一面,就是對錢的看法。你知道他一生清白,公私分明,嚴格到極點。他幫助人也有極強的原則性,凡是不正當的用途,便是知己的朋友也不肯通融(我親眼見過這種例子),凡是人家真有為難而且是正當用途,就是素不相識的也肯慨然相助。就是說,他對什麼事都嚴肅看待,理智強得不得了。不像我是無原則的人道主義者,有求必應。你在金錢方面只承繼了媽媽的缺點,一些也沒學到爸爸的好處。爸爸從來不肯有求于人。這二年來營養之缺乏,非你所能想像,因此百病叢生,神經衰弱、視神經衰退、關節炎、三叉神經痛,各種慢性病接踵而來。他雖然一向體弱,可也不至于此伏彼起的受這麼多的折磨。他自己常嘆衰老得快,不中用了。我看著心里干著急。有幾個知己朋友也為之擔心,但是有什麼辦法呢?大家都一樣。人家提議︰“為什麼不上飯店去吃幾頓呢?”“為什麼不叫兒子寄些食物來呢?”他卻始終硬挺,既不願出門,也不肯向你開口;始終抱著置生命于度外的態度。(我不知道你有沒有體會到爸爸這幾年來的心情?他不願,我也不願與你提,怕影響你的情緒。)後來我實在看不下去,便在去年十一月二十六日的信未向你表示。……你來信對此不提及。今年一月五日你從Malta[馬耳他]來信還是只字不提,于是我不得不在一月六日給你的信上明明白白告訴你︰“像我們這樣的父母,向兒子開口要東西是出于不得己,這一點你應該理解到。爸爸說不是非寄不可,只要回報一聲就行,免得人伸著脖子等。”二月九日我又寫道︰“我看他思想和心理活動都很復雜,每次要你寄食物的單子,他都一再躊躇,仿佛向兒子開口要東西也顧慮重重,並且也怕增加你的負擔。你若真有困難,應當來信說明,免得他心中七上八下。否則也該來信安慰安慰他。每次單子都是我從旁作主的。”的確,他自己也承認這一方面有復雜的心理(complex),有疙瘩存在,因為他覺得有求于人,即使在骨肉之間也有屈辱之感。你是非常敏感的人,但是對你爸爸媽媽這方面的領會還不夠深切和細膩。我一再表示,你好像都沒有感覺,從來沒有正面安慰爸爸。 你在倫敦別錯過lookingupongreatthings(觀賞偉大藝術品]的機會,博物館和公園對你同樣重要。哥哥坏 以三十年前的法國情況作比,英國的音樂空氣要普遍得多。固然,普遍不一定就是水平高,但質究竟是從量開始的。法國一離開巴黎就顯得閉塞,空無所有;不像英國許多二等城市還有許多文化藝術活動。不過這是從表面看;實際上群眾的水平,反應如何,要問你實地接觸的人了。望來信告知大概。你在西歐住了一年,也跑了一年,對各國音樂界多少有些觀感,我也想知道。便是演奏場子吧,也不妨略敘一敘。例如以音響效果出名的FestivaIHall[節日廳]?,究竟有什麼特點等等。哥哥坏妹妹爱 最近有人批判王氏的“無我之境”,說是寫純客觀,脫離階級斗爭。此說未免褊狹。第一,純客觀事實上是辦不到的。既然是人觀察事物,無論如何總帶幾分主觀,即使力求擺脫物質束縛也只能做到一部分,而且為時極短。其次能多少客觀一些,精神上倒是真正獲得松弛與休息,也是好事。人總是人,不是機器,不可能二十四小時只做一種活動。生理上就使你不能不飲食睡眠,推而廣之,精神上也有各種不同的活動。便是目不識丁的農夫也有出神的經驗,雖時間不過一剎那,其實即是無我或物我兩忘的心境。藝術家表現出那種境界來未必會使人意志頹廢。例如念了“寒波淡淡起,白鳥悠悠下”兩句詩,哪有一星半點不健全的感覺?假定如此,自然界的良辰美景豈不成年累月擺在人面前,人如何不消沉至于不可救藥的呢?相反,我認為生活越緊張越需要這一類的調劑;多親遠大自然倒是維持身心平衡最好的辦法。近代人的大病即在于拼命損害了一種機能(或一切機能)去發展某一種機能,造成許多畸形與病態。我不斷勸你去郊外散步,也是此意。幸而你東西奔走的路上還能常常接觸高山峻嶺,海洋流水,日出日落,月色星光,無形中更新你的感覺,解除你的疲勞。等你讀了《希臘雕塑》的譯文,對這些方面一定有更深的體會。哥哥爱色阁 甦領館酒會後?,招待看海軍文工團的歌舞︰第一支老的合唱,極好。新的歌曲,平常。新編的舞蹈,叫做“舞蹈練習曲”,極佳。戲劇與舞蹈是斯拉夫民族傳統中的精華,根基厚,天賦高,作品自不同凡響。那個舞蹈既戲劇化,又極富于造型美,等于一出生動的啞劇。配音也妙。這是我非常欣賞的。 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