0

Scrollbar in Listbox moves to last selected item

asked 哥哥干嘛哥哥干嘛压我avST银亿债券再度违约 年内股价跌幅超7成

發布時間︰

他用手背使勁地擦去汗濕的、零亂的頭發上的汗水。“當然,我請教了 所有的名醫??只要哪兒有一位高手名醫,我門就驅車前往。??我把他們 大家都延請到我家來,他們侃侃而談,用拉丁文發表意見,討論,會診,這 一位用這種方法試試,另一位又用那種方法試試,然後他們說,他們希望, 他們深信,如何如何,說罷拿了錢就走,一切又依然如故。是呀,病情有所 好轉,真的已經大大好轉。從前她一直不得不仰臥平躺在床上,全身都已經 癱瘓??現在至少雙臂、上身恢復正常,她可以獨自撐著拐杖走路??有所 好轉,不,應該說,大大好轉,我不能冤枉人家??但是還沒有一個人幫助 她痊愈??所有的大夫都無可奈何地聳聳肩膀,說道︰耐心一點,耐心一 點??只有一個醫生始終堅持給她治病,這就是康多爾大夫??我不知道您 是否听到過他的名字。您不也是從維也納來的嗎?” 急!我們現在談的全是正經話,不開任何玩笑,我寧可再說一遍,說得清清 楚楚︰我覺得病狀並沒有變樣,而是在她心里有什麼東西變了佯。她今天心 里有事,什麼事,我不知道。我第一次有這種感覺,不曉得怎麼搞的,她從 我手里溜掉了。”——他又吸了一口他的雪前,然後用他鋒利的小眼楮,很 快地瞟了開克斯法爾伐一眼。“您知道嗎,最好我們立刻開誠布公地談談這 件事情。我們相互之間總用不著不好意思。我們完全可以把牌亮出來。好 吧??親愛的朋友,請您告訴我,請您現在老老實實清楚明了地告訴我︰你 們在這段時間內由于焦急得沉不住氣,是不是請了另外一位醫生?有沒有另 外一個人在我不在的時候給艾迪特檢查或者治療過?”哥哥干嘛 “我們最好從頭講起,先把貴族大人拉約斯?封?開克斯法爾伐完全擱 在一邊。因為那時候還根本不存在這麼一個貴族呢。既不存在身穿黑上衣、 眼戴金絲邊眼鏡的地主,更不存在這麼一個顯貴。在匈牙利和斯洛伐克邊境 的一個貧窮不堪的村子中只有一個瘦小的猶太少年,胸部狹窄、眼光犀利, 名叫萊奧波爾特?卡尼茲,我想,大家一般只管他叫萊默爾??卡尼茲。” 我听了大概直跳了起來,或者用什麼別的方式表示了我的極度驚訝,因 為我對什麼都有思想準備,惟獨對于這點大出意料。可是康多爾面含微笑,哥哥干嘛压我 但是一旦內心失去平衡,無論我怎麼自我說服,自我打氣全部無濟于事! 我感覺到,約茨西和費倫茨的鼓舌咂嘴、滿臉驚愕,已經徹底摧毀了我那良 好的、頗有點但然自在的心境。我不禁懷疑地反躬自問︰你難道的的確確只 出于同情,只是出于憐憫才到這個富翁家里去的嗎?在這後面是否也隱藏著 相當分量的虛榮心和享樂欲?反正得把這事弄弄明白。我決定采取的第一個 措施乃是,從現在起,我對他們的訪問要隔開一段時間,明天下午對開克斯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