see Select and SelectOption and SelectOptions components -igor
On Fri, Mar 5, 2010 at 6:30 AM, Torben Berger <[email protected]> wrote: > Hi, > I'm trying to write a dynamic Select with optgroups. > > Therefore I've got a ListView where I want to set the label of the optgroup > with the onComponentTag method. > Everything is working except of setting this label. The onComponentTag > method is never called. > > Maybe someone can give me a hint how to resolve this problem. What am I doing > wrong? > > This is my Select: > > private Select = new Select("select", new PropertyModel<T>(this, > "selectedOption")); > > ListView<Collection<T>> optGroups = new ListView<Collection<T>>("optGroups", > groups) { > > �...@override > protected void populateItem(ListItem<Collection<T>> item) { > item.add(new SelectOptions<T>("options", new > ArrayList<T>(item.getModelObject()), renderer)); > } > > �...@override > protected void onComponentTag(final ComponentTag tag) { > super.onComponentTag(tag); > tag.put("label", "Foo"); > } > }; > select.add(optGroups); > > add(select); > > And the markup: > > <select wicket:id="select"> > <optgroup wicket:id="optGroups"> > <wicket:container wicket:id="options"> > <option wicket:id="option"></option> > </wicket:container> > </optgroup> > </select> > > > Best regards, > Torben > > > -- > GMX DSL: Internet, Telefon und Entertainment für nur 19,99 EUR/mtl.! > http://portal.gmx.net/de/go/dsl02 > > --------------------------------------------------------------------- > 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]
