You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2012/05/10 14:01:51 UTC

[jira] [Resolved] (WICKET-1785) Ability to add attributes to drop-down-list (select) options

     [ https://issues.apache.org/jira/browse/WICKET-1785?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov resolved WICKET-1785.
-------------------------------------

    Resolution: Duplicate

Improved with WICKET-2674 (Wicket 1.5.6+).
                
> Ability to add attributes to drop-down-list (select) options
> ------------------------------------------------------------
>
>                 Key: WICKET-1785
>                 URL: https://issues.apache.org/jira/browse/WICKET-1785
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.4-M3
>            Reporter: Martin Makundi
>            Priority: Minor
>   Original Estimate: 5m
>  Remaining Estimate: 5m
>
> Time-after-time, there is need to style your select options in a DropDownChoice component. For example, the different options need to have different background colour, or something.
> This can be accomplished using Select/SelectOption, but here you are required to re-implement all the intelligence already built into the dropdownchoice/listchoice component (automatic notnull and localization, for example). 
> How could we leverage the existing functionality of the DropDownChoice but enhance it with the ability to parametrize option attributes individually?
> Our suggestion is that we refactor suitable hooks into the rendering phase of the xxChoice components, i.e., a method along the lines of  "String getOptionAttributes(T t)" to be called, during the render phase of a DropDownChoice (in order to add attributes for the option tag).
> With this kind of impementation it would then be easier for anybody to 'sugarcoat' their DropDownChoice without breaking the existing inplementations. For example, one way to use it would be to just add a getDispayStyle method into your implementation of the IChoiceRenderer, and implement a respective check in your overriding "getOptionAttributes" -method:
> MyDropDownChoice extends DropDownChoice() { 
>   @Override
>   protected String getOptionAttributes(T t) {
>     if (renderer instanceof MyChoiceRenderer) { 
>       ... and sugarcoat my option ... 
>     }
>   }
> }
> More discussion can be found at: http://www.nabble.com/color-code-options-in-drop-down-choice-tp16964792p18909328.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira