0

Scrollbar in Listbox moves to last selected item

asked 亚洲图片区亚洲色图片亚洲人妻av伦理宝马女醉驾被查崩溃撒娇:我是个网红 我不要坐牢

發布時間︰

傅雷是一個典型的中國知識分子,他不能違背自己的心靈,他同樣不能違反自己的邏輯,不能忍受自己的思想被霸佔,更不能讓自己的靈魂被否定,所以他選擇了死。 亚洲图片区 “父親既然欣賞‘抬著棺材見皇帝’的死諫品德,在歷次政治運動中,做人氣節上,他思齊。”傅敏說。1957年,傅雷受到批判,有人暗示他承認反黨反社會主義就可以過關。他不干,後挑明,說成實質上是反黨反社會主義也行,傅雷堅辭。自然地,1958年他被人戴上右派帽子。這天他夜半歸家,夫人朱梅馥擔心出事。傅敏成人後听母親講,“就因為他考慮你還小……否則他就走了。”1961年傅雷摘帽。傅敏親見父親得知這一事實後,面無表情,繼續伏案。現已閱事滄桑的傅敏理解父親當時的處事邏輯︰“戴帽子的是他們,摘帽子的也是他們,跟自己無關。如果父親為摘帽而感恩戴德,則說明父親承認自己是右派。因為父親不承認強加給自己頭上的莫須有,所以對帽子來去漠然視之。”亚洲色图片 縱觀《家書》,愛、藝術、人生構成它的三大主題,《家書》是在愛的主旋律下,展現人生舞台的獨幕劇。每一位讀者都是觀眾,在傅雷那顆“博愛的心”感召下,在藝術的燻陶中,接受人生的洗禮。 我不由自主地受他誘惑,舉目向鄰桌望去,以便隔著兩米遠的距離觀察一下這位一度蓋上歷史 印記的英雄人物。可是我在那兒踫上了一道嚴峻溫怒的目光,似乎想說︰那家伙向您胡謅了什麼關于 我的事情了嗎?我臉上沒什麼可看的!與此同時,這位先生做了一個顯而易見的下友好動作,把椅子 住旁邊一挪,斷然地把脊背朝向我們。我有些不好意思,收回我的目光,從此不再瞅他,哪怕只是出 于好奇也決不去瞟一眼那張桌子的桌布。不久我就向我那位善良的饒舌朋友告辭,可是在我跨出門去 的時候就已經看見,他馬上換了個座位,坐到他的主人公那里去了,大概是以同樣的熱心向那位介紹 我,就像他向我介紹那位一樣。亚洲人妻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