0

Problem with listbox selectedItem at the page creation

asked 2010-07-23 04:10:20 +0800

SHERKHAN gravatar image SHERKHAN
231 3

Hi all,

I would like setting the selectedIndex of my listbox at the page creation. I use a model for my listbox, and set it in the composer constructor, and set the selected index in doAfterCompose... But it doesn't work. The index is out of bound, so I don't know how I can do...

I suppose the listbox is not still rendered...

Here is the zul file part:

 <listbox id="companyListbox" width="100px" model="@{composer.companyModel}" mold="select" >
                    <listitem self="@{each=companyData}">
                        <listcell label="@{companyData.company.name}" />
                    </listitem>
                </listbox>

Or maybe because I bind the composer to the window in do afterCompose...

@Override
    public void doAfterCompose(Component comp) throws Exception {
        super.doAfterCompose(comp);
        DataBinder binder = new AnnotateDataBinder(comp);
        binder.bindBean("composer", this);
        binder.loadAll();
    }

Thanks for you help,

Regards,

SHERKHAN

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2010-07-25 20:54:33 +0800

samchuang gravatar image samchuang
4084 4

Hi

from above code, I didn't see code that handle setting selectedIndex

Could you post your complete sample code, include Java and Zul file ?

link publish delete flag offensive edit

answered 2010-07-26 02:55:16 +0800

SHERKHAN gravatar image SHERKHAN
231 3

Hi samchuang,

It's ok, I find out the problem... I decided to use a renderer, and set the index inside...

Thanks for you help,

Best regards,

SHERKHAN

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2010-07-23 04:10:20 +0800

Seen: 323 times

Last updated: Jul 26 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More