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]