Hi, Thanks for replying. Just to clarify, do you mean do something like this:
LoadableDetachableModel<List<MyRecord>> myRecordsModel = new LoadableDetachableModel<List<MyRecord>>() { @Override protected List<MyRecord> load() { return myRecordService.getList(); } }; MyRecord selectedRecord; form.add(new DropDownChoice<MyRecord>("records", new PropertyModel<MyRecord>(this, "selectedRecord"), myRecordsModel, new MyRecordRenderer()).setNullValid(false)); Shelli -----Original Message----- From: jcgarciam [mailto:jcgarc...@gmail.com] Sent: Monday, October 04, 2010 6:27 PM To: users@wicket.apache.org Subject: Re: DropDownChoice/Model Confusion Hi, instead of passing "getMyRecords()" in the constructor wrap it around a LoadableDetachableModel and pass that model to the DDC. The difference is that your current list is fetch only once at construction of your pages and is considered static because its never get called again unless you triggered it by entering to a new page instance, while by using a LDM the component will ask for it every time it needs to re-render them. On Mon, Oct 4, 2010 at 6:52 PM, Shelli Orton [via Apache Wicket] < ml-node+2955144-665570512-65...@n4.nabble.com<ml-node%2B2955144-66557051 2-65...@n4.nabble.com> > wrote: > I am writing a (simple?) database CRUD app where I have multiple tab > panels that encapsulate the different tables in the database. On a > panel there's a dropdownchoice which lists the existing records for that > table. There's also create, delete and edit buttons (and and edit panel > with save and cancel buttons). When I create, edit or delete any of the > records, the dropdownchoice list doesn't reflect the changes until I > open a new session. So my question is how to reload the list after one > of these actions is done? > > Currently my dropdownchoice model is set like this: > > MyRecord selectedRecord; > ... > form.add(new DropDownChoice<MyRecord>("records", > new PropertyModel<MyRecord>(this, "selectedRecord"), > getMyRecords(), // method that retrieves from the database (via > JPA) > new MyRecordRenderer()).setNullValid(false)); // used to return > the display attribute of MyRecord > > I am trying to understand if using a LoadableDetachableModel will do the > reload that I want. Also, I don't know how to set the selectedRecord > using that type of model or if it's even possible. > > Any advice? > > Thanks! > > Shelli > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=2955144&i=0> > For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=2955144&i=1> > > > > ------------------------------ > View message @ > http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Model-Confusio n-tp2955144p2955144.html > To start a new topic under Apache Wicket, email > ml-node+1842946-398011874-65...@n4.nabble.com<ml-node%2B1842946-39801187 4-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=amNnYXJjaWFtQGdtYWlsLmNvbXwxOD QyOTQ2fDEyNTYxMzc3ODY=>. > > > -- 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-Confusio n-tp2955144p2955255.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 --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org