By the way, your html should look like below, your HTML above is not correct:
<select wicket:id="selectGroup">
<optgroup label="Label 1">
<option></option>
<option></option>
</optgroup>
<optgroup label="Label 2">
<option></option>
<option></option>
</optgroup>
</select>
--Andrew
On 11/3/05, Igor Vaynberg <[EMAIL PROTECTED]
> wrote:
I dont really understant what you mean.
If you want to do it like the Check/CheckGroup is done you would have a SelectGroup and Select components that you would put into your html and then you can manually insert <optgroup>
ie
<select wicket:id="selectGroup">
<optgroup>wicket doesnt care</optgroup>
<select wicked:id="choice1">
<select wicket:id="choice2">
</optgroup>
</select>
But then you are talking about making it a single component, so that is not like the Check/CheckGroup work.
If i was going to build it as a single component I would use the embedded objects like you mentioned, not a map. Ie
class OptGroup { List choices; IModel title; }
and my component would take a list of optgroups.
OR maybe something smoother would be to do extend the current DropDownChoice to do an instanceof check on the item its rendering and if its an OptGroup object write out the OptGroup.
Thoughts?
-Igor
On 11/3/05, Andrew Berman <[EMAIL PROTECTED] > wrote:I'm sure this is Igor's territory, but I was wondering if, like how Check/CheckGroup and Radio/RadioGroup was done, if we could also add something to permit optgroups. My thought was to have something like a Select object which takes a list of OptGroup components. The OptGroup component then takes a list of SelectOption components.
The other way I was thinking about it was to add a constructor to DropDownChoice and ListMultipleChoice which takes a Map. Then each Map key could be the optgroup value and the value could be a list of what should appear within that optgroup.
Thoughts?
--Andrew
