whenever a listview contains form components you have to call setreuseitems(true).
its in the javadoc, it has been mentioned on this list a thousand times. its probably on the wiki page somewhere. -igor On Thu, Feb 12, 2009 at 3:09 AM, Mathias P.W Nilsson <[email protected]> wrote: > > Hi, > > I'm using CompoundPropertyModel on a form. When using with SelectOption I > can't set the selected index. > The "none" select option is there to add a none to the list. How can I set > the selected option in the listview? Any Pointers? > > materialCategoryInformation = new Select("materialCategoryInformation" ); > materialCategoryInformation.add(new SelectOption("none", new > Model(/*NULL*/))); > materialCategoryInformation.setRequired(true); > materialCategoryInformation.setOutputMarkupId( true ); > > ListView materialCategoryList = new ListView( "materialCategoryList" > , materialCategoryModel ){ > private static final long serialVersionUID = 1L; > > @Override > protected void populateItem( final ListItem item ){ > item.setRenderBodyOnly( true ); > final CodedChainInformation codedInformation = > (CodedChainInformation) item.getModelObject(); > > SelectOption option = new SelectOption( "option" , new > Model( > (Serializable) item.getModelObject() )){ > private static final long > serialVersionUID = 1L; > > @Override > protected void onComponentTagBody( > MarkupStream markupStream, > ComponentTag tag ){ > String name = > codedInformation.getName(); > if( ! codedInformation.isSeparator() ) > name = " " + name; > replaceComponentTagBody(markupStream, > tag, name ); > > } > }; > > item.add( option ); > > if( codedInformation.isSeparator() ){ > option.add( new SimpleAttributeModifier( > "class" , "separator" > )); > }else{ > option.add( new SimpleAttributeModifier( > "class" , "sub" ) ); > } > > > } > }; > -- > View this message in context: > http://www.nabble.com/Model-on-Select-tp21973981p21973981.html > Sent from the Wicket - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
