You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Martijn Lindhout <ml...@jointeffort.nl> on 2008/02/16 21:09:21 UTC

ListView ajax update

Hi,

I have a listview with items, and a link below the list. The link opens a
form below the list (via AJAX), and the form can be submitted. An item then
is added the model underlying the listview. I added the listview to the
AjaxRequestTarget, but the list doesn't update. When I navigate away from
the page and then back, the list is updated with the new item.

Does anyone know what I need to do here?

-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
mlindhout@jointeffort.nl
+31 (0)6 18 47 25 29

Re: ListView ajax update

Posted by Martijn Lindhout <ml...@jointeffort.nl>.
thanx, I fixed it and it now works.

2008/2/16, Martijn Lindhout <ml...@jointeffort.nl>:
>
> ouch no! The list was:
>
> List<IFunctieTitel> lst = new ArrayList<IFunctieTitel>(emp.getFuncties());
>
> and I add it to emp.getFuncties(). That must be the problem.
>
> 2008/2/16, Igor Vaynberg <ig...@gmail.com>:
> >
> > and are you then adding the item back into the same instance of list
> > that you gave to the listview? because to me it looks like you have
> > created a copy of a list and then gave that copy to the listview...
> >
> > -igor
> >
> >
> > On Feb 16, 2008 12:34 PM, Martijn Lindhout <ml...@jointeffort.nl>
> > wrote:
> > > thanx, these are the first lines in the constructor:
> > >
> > > IMedewerker emp = (IMedewerker) getModelObject();
> > >         List<IFunctieTitel> lst = new ArrayList<IFunctieTitel>(
> > > emp.getFuncties());
> > >         final WebMarkupContainer listWmc = new
> > > WebMarkupContainer("listWmc");
> > >         listWmc.setOutputMarkupId(true);
> > >         ListView lv = new ListView("functies", lst){
> > >             @Override
> > >             protected void populateItem(ListItem item) {
> > >                 item.add(new Label("ftitel", new PropertyModel(
> > item.getModel(),
> > > "naam")));
> > >                 item.add(DateLabel.forDatePattern("dig", new
> > PropertyModel(
> > > item.getModel(), "datumIngang.value"), "dd-MM-yyyy"));
> > >                 item.add(DateLabel.forDatePattern("deg", new
> > PropertyModel(
> > > item.getModel(), "datumEinde.value"), "dd-MM-yyyy"));
> > >                 item.add(new Label("groep", new PropertyModel(
> > item.getModel(),
> > > "woongroep.naam.value")));
> > >             }
> > >         };
> > >         listWmc.add(lv);
> > >         add(listWmc);
> > >
> > >
> > >
> > > 2008/2/16, Igor Vaynberg <ig...@gmail.com>:
> > > >
> > > > then show some code...maybe you are not using the right kind of
> > model
> > > > to feed the listview
> > > >
> > > > -igor
> > > >
> > > >
> > > > On Feb 16, 2008 12:20 PM, Martijn Lindhout <mlindhout@jointeffort.nl
> > >
> > > > wrote:
> > > > > although I didn't search the wiki (I'll do it again from now), and
> > I
> > > > already
> > > > > had that solution, it still doesn't work. :-(
> > > > >
> > > > > 2008/2/16, Igor Vaynberg <ig...@gmail.com>:
> > > > >
> > > > > >
> > > > > > please try searching the wiki before posting to the list...
> > > > > >
> > > > > >
> > http://cwiki.apache.org/WICKET/how-to-repaint-a-listview-via-ajax.html
> > > > > >
> > > > > > -igor
> > > > > >
> > > > > >
> > > > > > On Feb 16, 2008 12:09 PM, Martijn Lindhout <
> > mlindhout@jointeffort.nl>
> > > > > > wrote:
> > > > > > > Hi,
> > > > > > >
> > > > > > > I have a listview with items, and a link below the list. The
> > link
> > > > opens
> > > > > > a
> > > > > > > form below the list (via AJAX), and the form can be submitted.
> > An
> > > > item
> > > > > > then
> > > > > > > is added the model underlying the listview. I added the
> > listview to
> > > > the
> > > > > > > AjaxRequestTarget, but the list doesn't update. When I
> > navigate away
> > > > > > from
> > > > > > > the page and then back, the list is updated with the new item.
> > > > > > >
> > > > > > > Does anyone know what I need to do here?
> > > > > > >
> > > > > > > --
> > > > > > > Martijn Lindhout
> > > > > > > JointEffort IT Services
> > > > > > > http://www.jointeffort.nl
> > > > > > > mlindhout@jointeffort.nl
> > > > > > > +31 (0)6 18 47 25 29
> > > > > > >
> > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > >
> > > > > Martijn Lindhout
> > > > > JointEffort IT Services
> > > > > http://www.jointeffort.nl
> > > > > mlindhout@jointeffort.nl
> > > > > +31 (0)6 18 47 25 29
> > > > >
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Martijn Lindhout
> > > JointEffort IT Services
> > > http://www.jointeffort.nl
> > > mlindhout@jointeffort.nl
> > > +31 (0)6 18 47 25 29
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Martijn Lindhout
> JointEffort IT Services
> http://www.jointeffort.nl
> mlindhout@jointeffort.nl
> +31 (0)6 18 47 25 29
>



-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
mlindhout@jointeffort.nl
+31 (0)6 18 47 25 29

Re: ListView ajax update

Posted by Martijn Lindhout <ml...@jointeffort.nl>.
ouch no! The list was:

List<IFunctieTitel> lst = new ArrayList<IFunctieTitel>(emp.getFuncties());

and I add it to emp.getFuncties(). That must be the problem.

2008/2/16, Igor Vaynberg <ig...@gmail.com>:
>
> and are you then adding the item back into the same instance of list
> that you gave to the listview? because to me it looks like you have
> created a copy of a list and then gave that copy to the listview...
>
> -igor
>
>
> On Feb 16, 2008 12:34 PM, Martijn Lindhout <ml...@jointeffort.nl>
> wrote:
> > thanx, these are the first lines in the constructor:
> >
> > IMedewerker emp = (IMedewerker) getModelObject();
> >         List<IFunctieTitel> lst = new ArrayList<IFunctieTitel>(
> > emp.getFuncties());
> >         final WebMarkupContainer listWmc = new
> > WebMarkupContainer("listWmc");
> >         listWmc.setOutputMarkupId(true);
> >         ListView lv = new ListView("functies", lst){
> >             @Override
> >             protected void populateItem(ListItem item) {
> >                 item.add(new Label("ftitel", new PropertyModel(
> item.getModel(),
> > "naam")));
> >                 item.add(DateLabel.forDatePattern("dig", new
> PropertyModel(
> > item.getModel(), "datumIngang.value"), "dd-MM-yyyy"));
> >                 item.add(DateLabel.forDatePattern("deg", new
> PropertyModel(
> > item.getModel(), "datumEinde.value"), "dd-MM-yyyy"));
> >                 item.add(new Label("groep", new PropertyModel(
> item.getModel(),
> > "woongroep.naam.value")));
> >             }
> >         };
> >         listWmc.add(lv);
> >         add(listWmc);
> >
> >
> >
> > 2008/2/16, Igor Vaynberg <ig...@gmail.com>:
> > >
> > > then show some code...maybe you are not using the right kind of model
> > > to feed the listview
> > >
> > > -igor
> > >
> > >
> > > On Feb 16, 2008 12:20 PM, Martijn Lindhout <ml...@jointeffort.nl>
> > > wrote:
> > > > although I didn't search the wiki (I'll do it again from now), and I
> > > already
> > > > had that solution, it still doesn't work. :-(
> > > >
> > > > 2008/2/16, Igor Vaynberg <ig...@gmail.com>:
> > > >
> > > > >
> > > > > please try searching the wiki before posting to the list...
> > > > >
> > > > >
> http://cwiki.apache.org/WICKET/how-to-repaint-a-listview-via-ajax.html
> > > > >
> > > > > -igor
> > > > >
> > > > >
> > > > > On Feb 16, 2008 12:09 PM, Martijn Lindhout <
> mlindhout@jointeffort.nl>
> > > > > wrote:
> > > > > > Hi,
> > > > > >
> > > > > > I have a listview with items, and a link below the list. The
> link
> > > opens
> > > > > a
> > > > > > form below the list (via AJAX), and the form can be submitted.
> An
> > > item
> > > > > then
> > > > > > is added the model underlying the listview. I added the listview
> to
> > > the
> > > > > > AjaxRequestTarget, but the list doesn't update. When I navigate
> away
> > > > > from
> > > > > > the page and then back, the list is updated with the new item.
> > > > > >
> > > > > > Does anyone know what I need to do here?
> > > > > >
> > > > > > --
> > > > > > Martijn Lindhout
> > > > > > JointEffort IT Services
> > > > > > http://www.jointeffort.nl
> > > > > > mlindhout@jointeffort.nl
> > > > > > +31 (0)6 18 47 25 29
> > > > > >
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > >
> > > > Martijn Lindhout
> > > > JointEffort IT Services
> > > > http://www.jointeffort.nl
> > > > mlindhout@jointeffort.nl
> > > > +31 (0)6 18 47 25 29
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
> > --
> > Martijn Lindhout
> > JointEffort IT Services
> > http://www.jointeffort.nl
> > mlindhout@jointeffort.nl
> > +31 (0)6 18 47 25 29
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
mlindhout@jointeffort.nl
+31 (0)6 18 47 25 29

Re: ListView ajax update

Posted by Igor Vaynberg <ig...@gmail.com>.
and are you then adding the item back into the same instance of list
that you gave to the listview? because to me it looks like you have
created a copy of a list and then gave that copy to the listview...

-igor


On Feb 16, 2008 12:34 PM, Martijn Lindhout <ml...@jointeffort.nl> wrote:
> thanx, these are the first lines in the constructor:
>
> IMedewerker emp = (IMedewerker) getModelObject();
>         List<IFunctieTitel> lst = new ArrayList<IFunctieTitel>(
> emp.getFuncties());
>         final WebMarkupContainer listWmc = new
> WebMarkupContainer("listWmc");
>         listWmc.setOutputMarkupId(true);
>         ListView lv = new ListView("functies", lst){
>             @Override
>             protected void populateItem(ListItem item) {
>                 item.add(new Label("ftitel", new PropertyModel(item.getModel(),
> "naam")));
>                 item.add(DateLabel.forDatePattern("dig", new PropertyModel(
> item.getModel(), "datumIngang.value"), "dd-MM-yyyy"));
>                 item.add(DateLabel.forDatePattern("deg", new PropertyModel(
> item.getModel(), "datumEinde.value"), "dd-MM-yyyy"));
>                 item.add(new Label("groep", new PropertyModel(item.getModel(),
> "woongroep.naam.value")));
>             }
>         };
>         listWmc.add(lv);
>         add(listWmc);
>
>
>
> 2008/2/16, Igor Vaynberg <ig...@gmail.com>:
> >
> > then show some code...maybe you are not using the right kind of model
> > to feed the listview
> >
> > -igor
> >
> >
> > On Feb 16, 2008 12:20 PM, Martijn Lindhout <ml...@jointeffort.nl>
> > wrote:
> > > although I didn't search the wiki (I'll do it again from now), and I
> > already
> > > had that solution, it still doesn't work. :-(
> > >
> > > 2008/2/16, Igor Vaynberg <ig...@gmail.com>:
> > >
> > > >
> > > > please try searching the wiki before posting to the list...
> > > >
> > > > http://cwiki.apache.org/WICKET/how-to-repaint-a-listview-via-ajax.html
> > > >
> > > > -igor
> > > >
> > > >
> > > > On Feb 16, 2008 12:09 PM, Martijn Lindhout <ml...@jointeffort.nl>
> > > > wrote:
> > > > > Hi,
> > > > >
> > > > > I have a listview with items, and a link below the list. The link
> > opens
> > > > a
> > > > > form below the list (via AJAX), and the form can be submitted. An
> > item
> > > > then
> > > > > is added the model underlying the listview. I added the listview to
> > the
> > > > > AjaxRequestTarget, but the list doesn't update. When I navigate away
> > > > from
> > > > > the page and then back, the list is updated with the new item.
> > > > >
> > > > > Does anyone know what I need to do here?
> > > > >
> > > > > --
> > > > > Martijn Lindhout
> > > > > JointEffort IT Services
> > > > > http://www.jointeffort.nl
> > > > > mlindhout@jointeffort.nl
> > > > > +31 (0)6 18 47 25 29
> > > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > >
> > > Martijn Lindhout
> > > JointEffort IT Services
> > > http://www.jointeffort.nl
> > > mlindhout@jointeffort.nl
> > > +31 (0)6 18 47 25 29
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Martijn Lindhout
> JointEffort IT Services
> http://www.jointeffort.nl
> mlindhout@jointeffort.nl
> +31 (0)6 18 47 25 29
>

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


Re: ListView ajax update

Posted by Martijn Lindhout <ml...@jointeffort.nl>.
thanx, these are the first lines in the constructor:

IMedewerker emp = (IMedewerker) getModelObject();
        List<IFunctieTitel> lst = new ArrayList<IFunctieTitel>(
emp.getFuncties());
        final WebMarkupContainer listWmc = new
WebMarkupContainer("listWmc");
        listWmc.setOutputMarkupId(true);
        ListView lv = new ListView("functies", lst){
            @Override
            protected void populateItem(ListItem item) {
                item.add(new Label("ftitel", new PropertyModel(item.getModel(),
"naam")));
                item.add(DateLabel.forDatePattern("dig", new PropertyModel(
item.getModel(), "datumIngang.value"), "dd-MM-yyyy"));
                item.add(DateLabel.forDatePattern("deg", new PropertyModel(
item.getModel(), "datumEinde.value"), "dd-MM-yyyy"));
                item.add(new Label("groep", new PropertyModel(item.getModel(),
"woongroep.naam.value")));
            }
        };
        listWmc.add(lv);
        add(listWmc);


2008/2/16, Igor Vaynberg <ig...@gmail.com>:
>
> then show some code...maybe you are not using the right kind of model
> to feed the listview
>
> -igor
>
>
> On Feb 16, 2008 12:20 PM, Martijn Lindhout <ml...@jointeffort.nl>
> wrote:
> > although I didn't search the wiki (I'll do it again from now), and I
> already
> > had that solution, it still doesn't work. :-(
> >
> > 2008/2/16, Igor Vaynberg <ig...@gmail.com>:
> >
> > >
> > > please try searching the wiki before posting to the list...
> > >
> > > http://cwiki.apache.org/WICKET/how-to-repaint-a-listview-via-ajax.html
> > >
> > > -igor
> > >
> > >
> > > On Feb 16, 2008 12:09 PM, Martijn Lindhout <ml...@jointeffort.nl>
> > > wrote:
> > > > Hi,
> > > >
> > > > I have a listview with items, and a link below the list. The link
> opens
> > > a
> > > > form below the list (via AJAX), and the form can be submitted. An
> item
> > > then
> > > > is added the model underlying the listview. I added the listview to
> the
> > > > AjaxRequestTarget, but the list doesn't update. When I navigate away
> > > from
> > > > the page and then back, the list is updated with the new item.
> > > >
> > > > Does anyone know what I need to do here?
> > > >
> > > > --
> > > > Martijn Lindhout
> > > > JointEffort IT Services
> > > > http://www.jointeffort.nl
> > > > mlindhout@jointeffort.nl
> > > > +31 (0)6 18 47 25 29
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
> > --
> >
> > Martijn Lindhout
> > JointEffort IT Services
> > http://www.jointeffort.nl
> > mlindhout@jointeffort.nl
> > +31 (0)6 18 47 25 29
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
mlindhout@jointeffort.nl
+31 (0)6 18 47 25 29

Re: ListView ajax update

Posted by Igor Vaynberg <ig...@gmail.com>.
then show some code...maybe you are not using the right kind of model
to feed the listview

-igor


On Feb 16, 2008 12:20 PM, Martijn Lindhout <ml...@jointeffort.nl> wrote:
> although I didn't search the wiki (I'll do it again from now), and I already
> had that solution, it still doesn't work. :-(
>
> 2008/2/16, Igor Vaynberg <ig...@gmail.com>:
>
> >
> > please try searching the wiki before posting to the list...
> >
> > http://cwiki.apache.org/WICKET/how-to-repaint-a-listview-via-ajax.html
> >
> > -igor
> >
> >
> > On Feb 16, 2008 12:09 PM, Martijn Lindhout <ml...@jointeffort.nl>
> > wrote:
> > > Hi,
> > >
> > > I have a listview with items, and a link below the list. The link opens
> > a
> > > form below the list (via AJAX), and the form can be submitted. An item
> > then
> > > is added the model underlying the listview. I added the listview to the
> > > AjaxRequestTarget, but the list doesn't update. When I navigate away
> > from
> > > the page and then back, the list is updated with the new item.
> > >
> > > Does anyone know what I need to do here?
> > >
> > > --
> > > Martijn Lindhout
> > > JointEffort IT Services
> > > http://www.jointeffort.nl
> > > mlindhout@jointeffort.nl
> > > +31 (0)6 18 47 25 29
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
>
> Martijn Lindhout
> JointEffort IT Services
> http://www.jointeffort.nl
> mlindhout@jointeffort.nl
> +31 (0)6 18 47 25 29
>

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


Re: ListView ajax update

Posted by Martijn Lindhout <ml...@jointeffort.nl>.
although I didn't search the wiki (I'll do it again from now), and I already
had that solution, it still doesn't work. :-(

2008/2/16, Igor Vaynberg <ig...@gmail.com>:
>
> please try searching the wiki before posting to the list...
>
> http://cwiki.apache.org/WICKET/how-to-repaint-a-listview-via-ajax.html
>
> -igor
>
>
> On Feb 16, 2008 12:09 PM, Martijn Lindhout <ml...@jointeffort.nl>
> wrote:
> > Hi,
> >
> > I have a listview with items, and a link below the list. The link opens
> a
> > form below the list (via AJAX), and the form can be submitted. An item
> then
> > is added the model underlying the listview. I added the listview to the
> > AjaxRequestTarget, but the list doesn't update. When I navigate away
> from
> > the page and then back, the list is updated with the new item.
> >
> > Does anyone know what I need to do here?
> >
> > --
> > Martijn Lindhout
> > JointEffort IT Services
> > http://www.jointeffort.nl
> > mlindhout@jointeffort.nl
> > +31 (0)6 18 47 25 29
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
mlindhout@jointeffort.nl
+31 (0)6 18 47 25 29

Re: ListView ajax update

Posted by Igor Vaynberg <ig...@gmail.com>.
please try searching the wiki before posting to the list...

http://cwiki.apache.org/WICKET/how-to-repaint-a-listview-via-ajax.html

-igor


On Feb 16, 2008 12:09 PM, Martijn Lindhout <ml...@jointeffort.nl> wrote:
> Hi,
>
> I have a listview with items, and a link below the list. The link opens a
> form below the list (via AJAX), and the form can be submitted. An item then
> is added the model underlying the listview. I added the listview to the
> AjaxRequestTarget, but the list doesn't update. When I navigate away from
> the page and then back, the list is updated with the new item.
>
> Does anyone know what I need to do here?
>
> --
> Martijn Lindhout
> JointEffort IT Services
> http://www.jointeffort.nl
> mlindhout@jointeffort.nl
> +31 (0)6 18 47 25 29
>

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