Is it being detached?

On Tue, Oct 5, 2010 at 3:26 PM, Shelli Orton <shelli.or...@sjrb.ca> wrote:
> No, I'm not using AJAX.  Is there a way to force the LDB to reload?
>
> Shelli
>
> -----Original Message-----
> From: jcgarciam [mailto:jcgarc...@gmail.com]
> Sent: Tuesday, October 05, 2010 12:52 PM
> To: users@wicket.apache.org
> Subject: Re: DropDownChoice/Model Confusion
>
>
> I dont think it may be related to the hierarchy, are you using AJAX?
>
> On Tue, Oct 5, 2010 at 2:38 PM, Shelli Orton [via Apache Wicket] <
> ml-node+2956527-385265518-65...@n4.nabble.com<ml-node%2B2956527-38526551
> 8-65...@n4.nabble.com>
>> wrote:
>
>> Hmm, that code sort of works.  When I create or edit a record, the
> list
>> is updated.  However, when I delete a record it is not.  My component
>> hierarchy is set up like this (hope it makes sense):
>>
>> TabPanel
>>   - SelectForEditForm
>>     - MyRecords (DDC)
>>     - Add (Button)
>>     - Edit (Button)
>>     - Delete (Button)
>>   - EditGroup (WebMarkupContainer)
>>     - EditForm
>>       - MyRecord Name (TextField)
>>       - MyRecord Attribute (DDC)
>>       - Save (Button)
>>       - Cancel (Button)
>>
>> I created the EditGroup so that I can hide/display the edit panel.
>> Debugging the application shows that the save button onSubmit is
> called
>> before the update of the myRecordsModel LDM and this is why the list
> is
>> updated when I create/edit a record. The delete button onSubmit is
>> called after the update of the myRecordsModel LDM and that is why a
>> deleted record is still visible in the list.
>>
>> I think the issue has something to do with the buttons being in
>> different places in the component hierarchy. Can you provide any
>> guidance on if there's some way to have the LDM updated after the
> delete
>> onSubmit?
>>
>> Thanks again,
>> Shelli
>>
>> -----Original Message-----
>> From: jcgarciam [mailto:[hidden
> email]<http://user/SendEmail.jtp?type=node&node=2956527&i=0>]
>>
>> Sent: Tuesday, October 05, 2010 9:33 AM
>> To: [hidden email]
> <http://user/SendEmail.jtp?type=node&node=2956527&i=1>
>> Subject: Re: DropDownChoice/Model Confusion
>>
>>
>> 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] <
>> [hidden email]
> <http://user/SendEmail.jtp?type=node&node=2956527&i=2><ml-node%2B2956214
> -1797994
>>
>> [hidden email] <http://user/SendEmail.jtp?type=node&node=2956527&i=3>>
>> > 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-Confusi
> o?by-user=t>
>>
> <http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Model-Confusi
> <http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Model-Confusi
> ?by-user=t>
>> o?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-us
> er=t><
>>
>>
> http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?by-us
> <http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?by-u
> s&by-user=t>
>> er=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-Confusi
> o?by-user=t>
>>
> <http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Model-Confusi
> <http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Model-Confusi
> ?by-user=t>
>> o?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-Confusio
> <http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Model-Confusi
> o?by-user=t>
>> n-tp2955144p2956214.html
>> > To start a new topic under Apache Wicket, email
>> >
>> [hidden email]
> <http://user/SendEmail.jtp?type=node&node=2956527&i=4><ml-node%2B1842946
> -39801187
>>
>> [hidden email] <http://user/SendEmail.jtp?type=node&node=2956527&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-us
> er=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-Confusi
> o?by-user=t>
>> n-tp2955144p2956283.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=2956527&i=6>
>> For additional commands, e-mail: [hidden
> email]<http://user/SendEmail.jtp?type=node&node=2956527&i=7>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden
> email]<http://user/SendEmail.jtp?type=node&node=2956527&i=8>
>> For additional commands, e-mail: [hidden
> email]<http://user/SendEmail.jtp?type=node&node=2956527&i=9>
>>
>>
>>
>> ------------------------------
>>  View message @
>>
> http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-Model-Confusio
> n-tp2955144p2956527.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-tp2955144p2956669.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
>
>

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

Reply via email to