Yes, that should make your DDC to query the list any time it needs to re render.
To your 2nd. question in order to set a default or selected value, just set a "MyRecord" reference to your property, keep in mind that your "MyRecord" should implement and equals/hashcode correctly. On Tue, Oct 5, 2010 at 12:00 PM, Shelli Orton [via Apache Wicket] < ml-node+2956214-1797994246-65...@n4.nabble.com<ml-node%2b2956214-1797994246-65...@n4.nabble.com> > wrote: > 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:[hidden > email]<http://user/SendEmail.jtp?type=node&node=2956214&i=0>] > > Sent: Monday, October 04, 2010 6:27 PM > To: [hidden email] <http://user/SendEmail.jtp?type=node&node=2956214&i=1> > 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] < > [hidden email] > <http://user/SendEmail.jtp?type=node&node=2956214&i=2><ml-node%2B2955144-66557051 > > [hidden email] <http://user/SendEmail.jtp?type=node&node=2956214&i=3>> > > 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<http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Model-Confusio?by-user=t> > n-tp2955144p2955144.html > > To start a new topic under Apache Wicket, email > > > [hidden email] > <http://user/SendEmail.jtp?type=node&node=2956214&i=4><ml-node%2B1842946-39801187 > > [hidden email] <http://user/SendEmail.jtp?type=node&node=2956214&i=5>> > > To unsubscribe from Apache Wicket, click > here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?by-user=t>? > > 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<http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Model-Confusio?by-user=t> > n-tp2955144p2955255.html > Sent from the Users forum mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=2956214&i=6> > For additional commands, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=2956214&i=7> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=2956214&i=8> > For additional commands, e-mail: [hidden > email]<http://user/SendEmail.jtp?type=node&node=2956214&i=9> > > > > ------------------------------ > View message @ > http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Model-Confusion-tp2955144p2956214.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-tp2955144p2956283.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