0

Scrollbar in Listbox moves to last selected item

asked 狠狠撸小说狠狠撸狠狠射狠狠噜天神娱乐:涉嫌信披违法违规 遭证监会立案调查

發布時間︰

“這麼說您的話真的是可靠的??您不生我的氣了??真的不生氣 了?” 起先一切都順順當當。值得慶幸的是,我們這天十分緊張,為了演習而狠狠撸小说 狠狠撸狠狠射 然而已經做成的事情,總有自己的力量。現在辭呈已經寫好,我也不想 可是我只是很快地把我忘記了撂在桌上的信拿過來,塞進我胸口的衣袋里。 我們的確是在最後一瞬間進入大廳的。在長長的馬蹄形的桌子旁邊圍坐著全 團軍官,可是,上級軍官沒有入座,誰也不敢縱情歡樂,大家都像小學生似 的。上課鈴已經響過,老師隨時都可能走進教室來。狠狠噜 半夜三更,她的鈴聲會響個三四遍,她毫無顧忌地把我們大家叫醒,我們大 家心驚肉跳地跑到她的床前,以為她出了什麼事。她直挺挺地坐在那兒,神 情慌亂,眼楮直愣愣地望著前面,翻來覆去老是向我們問同一個問題,‘你 不以為,他至少會有點喜歡我,哪怕只喜歡非常、非常小的一丁點?我並不 是個丑八怪啊。’然後她就要面鏡子,可是馬上又把鏡子扔掉。過一會兒她 自己也認識到,她干的事完全是發瘋。可是兩個鐘頭以後,這出戲又從頭演 起。她在絕望之中問她父親,問約瑟夫,問使女們,甚至于前天的那個吉卜 賽女人——您還記得吧——她昨天又悄悄把那女人叫來,讓她算命,再算一 次??她已經給您寫了五次信,都是長信,寫完之後又全都撕掉。從早到晚, 從清晨到夜里,她想的、說的沒有別的,就是這事。有一次她要我到您那兒 去打听一下,您是不是喜歡她,哪怕就喜歡那麼一丁點,或者??您是不是 討厭她,因為您總是那麼沉默寡言,躲躲閃閃,她要我馬上去找您,在路上 截住您,馬上把司機叫來,讓他把車開出來。她把要我跟您說的,要我問您 的每一句話叮囑了我不下三次、四次、五次。最後,我都已經站在外面門廳 里了,鈴聲又響了起來,我得戴著帽子,穿著大衣回到她那兒去,並且憑我 母親的生命向她起誓,絕不向您暗示一星半點。唉,您知道什麼!對您來說, 只要您出去在身後關上大門,事情就算了結了。可是您剛走,她就把您跟他 說的每一句話都向我報告,她問我是否相信,我是否認為??我要是接著對 他說︰‘你瞧,他是多麼喜歡你’,她就對我嚷嚷︰‘你撒謊!這不是真的! 他今天沒跟我說過一句好話,’可是同時她又要我把剛才說的活再講一遍, 我得把這些話重復三遍並且發誓??另外還加上那個老爺子,他從那事以後 完全六神無主了,而他愛您、崇拜您就像他對他自己的孩子一樣。您真該看 看,他一連幾小時睜著一雙疲乏不堪的眼楮,坐在她的床邊,撫摩她,安慰 她,直到她終于沉沉入睡。然後他自己心煩意亂地在他自己的房間里徹夜踱 來踱去,踱來踱去??而您——您難道真的對這一切毫無覺察嗎?” 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