You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Nivedan Nadaraj <sh...@gmail.com> on 2010/07/09 09:39:27 UTC

Re Refreshing a DropDownChoice - CRUD Pattern

Hi All,

I have an issue with refreshing a DropDownChoice control. I would like the
dropdown to have the Choose One option aevery time I want to a particular
action like Create new account etc.

I think it is how I designed my CRUD pattern, that I have this issue. Would
like to get your ideas/suggestions on a standard pattern for CRUD. The one I
am using now is as follows. Please comment on it so I can correct it.

The hierarchy of the controls are as follows.

*ContainerPanel*: Acts as a container to house the *SearchPanel*

When the *ContainerPanel* is constructed, I create an instance of *
SearchPanel*.

As part of the *SearchPanel* construction
 a) I create instances of  *DetailPanel* and set the visibility to false.
 b) I create an instance of *SearchResultListPanel*
 c) The *DetailPanel* and *SearchResultListPanel* instances are added into *
SearchPanel*'s SearchForm(extends Form)  instance .

When I click on *New* button on *SearchPanel* and as part of the  onSubmit()
event I make the *DetailsPanel* visible.On the Details panel for the first
time the DropDownChoice
is renderd correctly with *Choose One* as the default option. -

After I create an entity via the *DetailsPanel*, I click on *New* again on
the *SearchPanel*,i.e to create a another entity. This time the dropdown
choice control does not have the
Choose One option.  I understand that the list is not in a refreshed state.
How can I get around this problem other than re-populating it.

I had a similar issue on the SearchPanel when I clicked Reset button, but
resolved it using *clearInput*() followed by *updateFormComponentModels()*;,
now this is within the particular Form constructor so I was able to access
the updateFormComponentModels(). Whereas now, the DropdownChoice is part of
the DetailsPanel form instance and updateFormComponentModel is protected.(
its not visible from SearchPanel)

Appreicate your time,

Thank you
Regards
Niv