You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Rich Livingstone <na...@bananasoft.net> on 2007/10/12 20:27:33 UTC

Refresh fields from model

I'm just not sure how to do this - for example, I have a drop down choice and
when it changes, I need to populate other fields. I had presumed the way to
do this was to change the values in an attached PropertyModel and any text
or other UI fields which were attached to this model would be automatically
updated. But this doesn't seem to be so.

It seems an obvious thing but I can't find it in any of the forums - if it's
possible it's got to be simple, yes ?
-- 
View this message in context: http://www.nabble.com/Refresh-fields-from-model-tf4614207.html#a13177078
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Refresh fields from model

Posted by Alex Objelean <al...@isdc.ro>.
http://cwiki.apache.org/WICKET/dropdownchoice-examples.html#DropDownChoiceExamples-UsingAjax
Here   is an example from wiki. 


Rich Livingstone wrote:
> 
> I'm just not sure how to do this - for example, I have a drop down choice
> and when it changes, I need to populate other fields. I had presumed the
> way to do this was to change the values in an attached PropertyModel and
> any text or other UI fields which were attached to this model would be
> automatically updated. But this doesn't seem to be so.
> 
> It seems an obvious thing but I can't find it in any of the forums - if
> it's possible it's got to be simple, yes ?
> 

-- 
View this message in context: http://www.nabble.com/Refresh-fields-from-model-tf4614207.html#a13177769
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Refresh fields from model

Posted by Christopher Gardner <ch...@gmail.com>.
I think another way to do it is to call setModelObject() with the
appropriate parameter on each component that needs to be updated.  I
chose to use the modelChanged() approach, however, because I'm using
the presentation model pattern
(http://martinfowler.com/eaaDev/PresentationModel.html) that populates
the model properties behind the scenes.  At least in my experience, I
had to call modelChanged() to reflect the new values.

By the way, so far, the presentation model pattern seems to work
nicely with Wicket.  This includes using the LoadableDetachableModel
to call the presentation model to get data to populate a ListView and
dereference the data for memory conservation.  The result is less
verbose Wicket code and the option to use the presentation model in
other web frameworks.  Only time will tell if this approach will scale
with Wicket.

Chris

On 10/15/07, Rich Livingstone <na...@bananasoft.net> wrote:
>
> Thanks, that worked great
>
>
>
> Christopher Gardner-2 wrote:
> >
> > I had to call modelChanged() to do this very thing.
> >
> > On 10/12/07, Rich Livingstone <na...@bananasoft.net> wrote:
> >>
> >> I'm just not sure how to do this - for example, I have a drop down choice
> >> and
> >> when it changes, I need to populate other fields. I had presumed the way
> >> to
> >> do this was to change the values in an attached PropertyModel and any
> >> text
> >> or other UI fields which were attached to this model would be
> >> automatically
> >> updated. But this doesn't seem to be so.
> >>
> >> It seems an obvious thing but I can't find it in any of the forums - if
> >> it's
> >> possible it's got to be simple, yes ?
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Refresh-fields-from-model-tf4614207.html#a13177078
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Refresh-fields-from-model-tf4614207.html#a13224136
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Refresh fields from model

Posted by Rich Livingstone <na...@bananasoft.net>.
Thanks, that worked great



Christopher Gardner-2 wrote:
> 
> I had to call modelChanged() to do this very thing.
> 
> On 10/12/07, Rich Livingstone <na...@bananasoft.net> wrote:
>>
>> I'm just not sure how to do this - for example, I have a drop down choice
>> and
>> when it changes, I need to populate other fields. I had presumed the way
>> to
>> do this was to change the values in an attached PropertyModel and any
>> text
>> or other UI fields which were attached to this model would be
>> automatically
>> updated. But this doesn't seem to be so.
>>
>> It seems an obvious thing but I can't find it in any of the forums - if
>> it's
>> possible it's got to be simple, yes ?
>> --
>> View this message in context:
>> http://www.nabble.com/Refresh-fields-from-model-tf4614207.html#a13177078
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Refresh-fields-from-model-tf4614207.html#a13224136
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Refresh fields from model

Posted by Christopher Gardner <ch...@gmail.com>.
I had to call modelChanged() to do this very thing.

On 10/12/07, Rich Livingstone <na...@bananasoft.net> wrote:
>
> I'm just not sure how to do this - for example, I have a drop down choice and
> when it changes, I need to populate other fields. I had presumed the way to
> do this was to change the values in an attached PropertyModel and any text
> or other UI fields which were attached to this model would be automatically
> updated. But this doesn't seem to be so.
>
> It seems an obvious thing but I can't find it in any of the forums - if it's
> possible it's got to be simple, yes ?
> --
> View this message in context: http://www.nabble.com/Refresh-fields-from-model-tf4614207.html#a13177078
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org