0

Scrollbar in Listbox moves to last selected item

asked 九七超碰人妻免费观看超碰人妻视频公开在线caoprnop分类超碰视频陈可辛《李娜》首曝卡司 法国影帝卡索确定出演

發布時間︰

“我說,這是原因之一,但主要卻是私人的原因。這個原因您也許會更加容易理解。那就是我 懷疑自己的資格,反正徹底懷疑我的英雄行為。我自己總比那些瞪著眼楮傻看傻瞧的陌生人知道得更 加清楚,佩帶這枚勛章的那個人絕非英雄,甚至可說正好是英雄的反面。有些人想要擺脫絕望的境地, 因而狂熱地投入戰爭,他就是其中之一。與其說是忠于職守的英雄,毋寧說是怕負責任的逃兵。我不 知道您的感覺如何,我至少覺得頭戴祥光和聖人光圈這樣的生活是極不自然、難以忍受的。自從我用 不著在我的軍裝上面掛著我的英雄業績招搖過市以來,我真覺得如釋重負。要是有人把我往日的光榮 抖摟出來,我現在遼會火冒三丈的。我何必不向您承認呢,昨天我差一點要走到您的桌邊向那個饒舌 的家伙嚷嚷,他要吹牛讓他拿別人去吹,別吹我。整個晚上您那充滿敬意的眼光一直叫我心里難受, 為了更正這個饒舌家伙的胡言亂語,我恨不得強迫您听我說,我是如何通過曲折的道路才當上這個英 雄的——這是一段離奇的故事,但它至少可以證明,勇氣往往不是別的,恰好是真正的軟弱。反正, 就是現在叫我把這故事坦率地講給您听,我也毫無顧慮。一個人生活中二十五年前發生的住事,已經 和他不再相干,早已是另一個人的事情了。您現在有空嗎?您听著不覺得無聊嗎?” 出乎我意料的是,那位榮獲瑪利亞?特利莎騎士勛章的先生這時挺身而出支持我的論點,剛才九七超碰人妻免费观看 二超碰人妻视频公开在线 可是繼而我又對自己說,胡扯,我想起來,老人如何深受感動地撫摩我 的衣袖,每次我剛跨進房門,他又如何變得容光煥發。我想起把我和兩個姑 娘連接在一起的那種真誠的、親如手足的友誼。她們肯定從來也不注意我是 否多喝了一杯;倘若看見了,她們也只會滿心歡喜,因為我在她們那里能吃 能喝。胡扯,荒唐,我連連對自己說,純粹胡扯——老人愛我勝過我的父親 呢。 勒生日紀念。伊羅娜。艾迪特。” 現在這三個人都直著眼楮瞪我。最後費倫茨喘了口氣︰“了不起,你新caoprnop分类超碰视频 ? 法文︰蠢事。 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