ChoiceFilteredPropertyColumn: access to the DropDownChoice
----------------------------------------------------------

                 Key: WICKET-1099
                 URL: https://issues.apache.org/jira/browse/WICKET-1099
             Project: Wicket
          Issue Type: Improvement
          Components: wicket-extensions
    Affects Versions: 1.3.0-beta4
         Environment: any
            Reporter: Jan Kriesten


To have the ChoiceFilter use a DropDown with setNullValid( true ) (for 
resetting the filter again in my case), I have to construct a complex new 
Filter like this:

new ChoiceFilteredPropertyColumn( new Model( "type" ), "property_type", "type", 
new Model( (Serializable) propertiesDao.getPropertyTypes() ) )
    {
      private static final long serialVersionUID = 1L;

      public Component getFilter( String componentId, FilterForm filterForm )
      {
        ChoiceFilter filter = new ChoiceFilter( componentId, getFilterModel( 
filterForm ), filterForm,
                getFilterChoices(), enableAutoSubmit() )
        {
          protected DropDownChoice newDropDownChoice( String id, IModel model, 
IModel choices,
                                                      IChoiceRenderer renderer )
          {
            DropDownChoice dropdown = new DropDownChoice( id, model, choices, 
renderer );
            dropdown.setNullValid( true );
            return dropdown;
          }
        };

        IChoiceRenderer renderer = getChoiceRenderer();
        if( renderer != null )
        {
          filter.getChoice().setChoiceRenderer( renderer );
        }
        return filter;
      }

This is much of copy-paste from the original sources just to do a simple 
"dropdown.setNullValid( true );" - it would be nice, if one could get hold of 
the dropdown in a more decent way.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to