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/09/03 12:20:07 UTC

[jira] [Commented] (WICKET-4730) Filter component does not clear filter fields

    [ https://issues.apache.org/jira/browse/WICKET-4730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13447192#comment-13447192 ] 

Martin Grigorov commented on WICKET-4730:
-----------------------------------------

I think the problem is in wicket.contrib.phonebook.web.page.ListContactsPage#createActionsColumn().
GoAndClearFilter properly clones the initial state and then reused it. But ListContactsPage recreates the whole filter again and again for each render and the form's model object could change at any time. If the filter is cached after the first creation then it works.

You patch wont work for model objects which have no default constructor. And empty state doesn't always mean "initial" state.
                
>  Filter component does not clear filter fields
> ----------------------------------------------
>
>                 Key: WICKET-4730
>                 URL: https://issues.apache.org/jira/browse/WICKET-4730
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-extensions
>    Affects Versions: 6.0.0-beta3
>            Reporter: Andreas Kuhtz
>         Attachments: commit-347c459
>
>
> The GoAndClearFilter.onClearSubmit() does not clear filter fields because the originalState member has the current values of the filter. I think it should create a new instance of the originalState class instead of clone the model.
> To verify use the phonebook sample (https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/phonebook). The clear only works if "go" was not pressed after enter some values in the filter, but if you press go and then want to clear the filter it keeps the values.
> Attached is a patch that makes the phonebook sample work.
> It might also be useful if the originalState attribute were made protected or accessible via protected method to allow users to overwrite the onClearSubmit() method and access the originalState attribute.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira