Problem sharing model between 2 panels

2008-09-05 Thread Neil McT

Here is the problem

I have a Parent panel which swaps in and out a Display panel and an Update
panel (these are basically 2 views, read-only and read-write, of a users
details).

To enable any changes by the Update panel to be seen by the Display panel, I
have both panels pointing to the same model, which in turn wraps the same
user object.

However, the Update panel uses a form to affect changes. This form also
points to the same Model / Object and herein lies the problem the form
maintains the same model throughout requests (as expected) BUT after
debugging I found that it seems to be creating a different underlying
model-object for each request. Therefore, while both my panels point to the
same Model / Object the form is making changes to a different Object!

Long story short after swapping the panels post-Update the changes are
not seen by the Display panel.

Is this form behaviour what you would expect to see?

If so, is there a more elegant solution than just manually copying the
changed fields between model-objects or grabbing the changed user object
from the db again?

Any help, very much appreciated.

Thanks - Neil.
-- 
View this message in context: 
http://www.nabble.com/Problem-sharing-model-between-2-panels-tp19330828p19330828.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem sharing model between 2 panels

2008-09-05 Thread Igor Vaynberg
the model that the display panel should be a loadable detachable model
so it loads data from the database on render

the model that the update panel uses should load the changes, edit
them, and save them to the database. that way everything is in sync.

when the form submits it clones the model object, that is done for
versioning reasons, but it is the clone that is kept...the reference
to the actual model object should not be changed.

-igor

On Fri, Sep 5, 2008 at 6:05 AM, Neil McT [EMAIL PROTECTED] wrote:

 Here is the problem

 I have a Parent panel which swaps in and out a Display panel and an Update
 panel (these are basically 2 views, read-only and read-write, of a users
 details).

 To enable any changes by the Update panel to be seen by the Display panel, I
 have both panels pointing to the same model, which in turn wraps the same
 user object.

 However, the Update panel uses a form to affect changes. This form also
 points to the same Model / Object and herein lies the problem the form
 maintains the same model throughout requests (as expected) BUT after
 debugging I found that it seems to be creating a different underlying
 model-object for each request. Therefore, while both my panels point to the
 same Model / Object the form is making changes to a different Object!

 Long story short after swapping the panels post-Update the changes are
 not seen by the Display panel.

 Is this form behaviour what you would expect to see?

 If so, is there a more elegant solution than just manually copying the
 changed fields between model-objects or grabbing the changed user object
 from the db again?

 Any help, very much appreciated.

 Thanks - Neil.
 --
 View this message in context: 
 http://www.nabble.com/Problem-sharing-model-between-2-panels-tp19330828p19330828.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]