Take a look at this, it may helps.

https://cwiki.apache.org/WICKET/lifecycle-of-a-wicket-application.html#LifecycleofaWicketApplication-ModelChanges

On Thu, Oct 7, 2010 at 2:15 PM, Shelli Orton [via Apache Wicket] <
ml-node+2967225-1123928259-65...@n4.nabble.com<ml-node%2b2967225-1123928259-65...@n4.nabble.com>
> wrote:

> Does nobody have any suggestions?  If I can't get this fixed, I'm going
> to have to write the app in another framework (possibly GWT) and I'd
> really rather not have to do that.
>
> Shelli
>
> -----Original Message-----
> From: Shelli Orton
> Sent: Wednesday, October 06, 2010 3:52 PM
> To: [hidden email] <http://user/SendEmail.jtp?type=node&node=2967225&i=0>
> Subject: PropertyModel Not Refreshing
>
> Hi,
>
> First, thanks to all who have been helping me as I am new to Wicket.  I
> am splitting out two issues I am dealing with to try to keep things
> clear.
>
> I am trying to write a simple app that does CRUD operations on database
> records.  The goal is for the app to make use of a tab panel where each
> tab encapsulates one table from the database.  Each tab panel has two
> groups (WebMarkupContainer).  The first, selectGroup, displays a list
> (DDC) of the current items, and three buttons, add, edit and delete.
> The second, editGroup, is displayed when either the add or edit button
> was clicked on the select group, displays the record attributes and save
> and cancel buttons.  The tab panel has a "selectedRecord" which is used
> by both groups' components via PropertyModels. Very basic stuff.
>
> When I choose a record and click the edit button, the record is
> displayed in the edit group properly.  If I then choose cancel, the edit
> group is no longer displayed and the select group DDC selection is null
> as expected. I then choose another record from the list and click the
> edit button and the previous record information is displayed in the edit
> group even though the select group DDC shows the correct/selected
> record.
>
> This problem also occurs if I first choose to add a new record and then
> cancel the add and then choose to edit a different record.  The DDC
> shows the correct/selected record, but all the attributes in the edit
> group are null/defaults for a new record.
>
> If I remove the call to setDefaultFormProcessing(false) on the cancel
> button, selecting other records for edit works correctly, but I can't
> cancel a creating a new record if I use a RequiredTextField because the
> form validation fails.
>
> If I select a record for editing or save the newly created record, I can
> select a different record for edit or create another one correctly.  So
> I must be doing something wrong in the cancel logic. My editForm
> (created in the EditGroup constructor) looks like this:
>
>             Form editForm = new Form("editForm");
>
>             editForm.add(new Label("nameLabel", "Name"));
>
>             editForm.add(new Label("attributeLabel", "Attribute"));
>
>             editForm.add(new RequiredTextField<String>("recordNameText",
>                     new PropertyModel<String>(MyRecordPanel.this,
>                             "selectedRecord.name")));
>
>             editForm.add(new DropDownChoice<Lir>("attributes",
>                     new PropertyModel<Attribute>(MyRecordPanel.this,
>                             "selectedRecord.attribute"),
>                     RateCentrePanel.this.getAttributes(),
>                     new AttributeRenderer()));
>
>             ....
>
>             editForm.add(new Button("cancel")
>             {
>                 private static final long serialVersionUID = 1L;
>
>                 public void onSubmit()
>                 {
>                     MyRecordPanel.this.selectedRecord = null;
>                     editGroup.setVisible(false);
>                     selectGroup.setVisible(true);
>                 }
>             }.setDefaultFormProcessing(false));
>
>             add(editForm);
>
> Other than setting the selectedRecord to null, what should I be doing
> differently?
>
> Thanks in advance!
>
> Shelli
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden 
> email]<http://user/SendEmail.jtp?type=node&node=2967225&i=1>
> For additional commands, e-mail: [hidden 
> email]<http://user/SendEmail.jtp?type=node&node=2967225&i=2>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden 
> email]<http://user/SendEmail.jtp?type=node&node=2967225&i=3>
> For additional commands, e-mail: [hidden 
> email]<http://user/SendEmail.jtp?type=node&node=2967225&i=4>
>
>
>
> ------------------------------
>  View message @
> http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Model-Confusion-tp2955144p2967225.html
> To start a new topic under Apache Wicket, email
> ml-node+1842946-398011874-65...@n4.nabble.com<ml-node%2b1842946-398011874-65...@n4.nabble.com>
> To unsubscribe from Apache Wicket, click 
> here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=>.
>
>
>


-- 
Sincerely,
JC (http://www.linkedin.com/in/jcgarciam)
Work smarter, not harder!.

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Model-Confusion-tp2955144p2967255.html
Sent from the Users forum mailing list archive at Nabble.com.

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

Reply via email to