You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Wayne W <wa...@gmail.com> on 2014/10/16 18:09:48 UTC

Is this possible?

We have a page that has a rather big DataView list. We need to be able to
make insertions and removals of this list without sending back the whole
list via AJAX as its a bit slow over the wire.

Is it possible to add a new element and return and insert that into the
list? Obviously we could insert in new item with JS on the page but we
still want to take advantage to any handlers in wicket for that new item
inserted into the list.

So something like:

....onSubmit(AjaxRequestTarget target)

{

Item<MyModel> item = new Item(); //!!

item.add(new AjaxFormComponentUpdatingBehavior("onchange")

{ protected void onUpdate(AjaxRequestTarget target) {...}});


thelist.add(item); //!!

...

target.appendJavaScript(js);

}



thanks

Wayne

Re: Is this possible?

Posted by Wayne W <wa...@gmail.com>.
Many thanks - I will have a look.

On Thu, Oct 16, 2014 at 7:21 PM, Zala Pierre GOUPIL <go...@gmail.com>
wrote:

> You can try wicket-quickview, which is based on the stuff in the link
> Martin provided. It works pretty well IMHO, and it is Wicket 6.0 compliant:
>
> https://github.com/vineetsemwal/quickview
>
> Regards,
>
> Pierre
>
>
>
>
>
> On Thu, Oct 16, 2014 at 6:28 PM, Martin Grigorov <mg...@apache.org>
> wrote:
>
> > Hi,
> >
> > I'd recommend you to use JS for something like this.
> > See
> >
> >
> http://wicketinaction.com/2008/10/repainting-only-newly-created-repeater-items-via-ajax/
> > .
> > Additionally I'd recommend to use event delegation, i.e. one change
> > listener on the dataview that handles 'change' for all items.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Thu, Oct 16, 2014 at 7:09 PM, Wayne W <wa...@gmail.com>
> > wrote:
> >
> > > We have a page that has a rather big DataView list. We need to be able
> to
> > > make insertions and removals of this list without sending back the
> whole
> > > list via AJAX as its a bit slow over the wire.
> > >
> > > Is it possible to add a new element and return and insert that into the
> > > list? Obviously we could insert in new item with JS on the page but we
> > > still want to take advantage to any handlers in wicket for that new
> item
> > > inserted into the list.
> > >
> > > So something like:
> > >
> > > ....onSubmit(AjaxRequestTarget target)
> > >
> > > {
> > >
> > > Item<MyModel> item = new Item(); //!!
> > >
> > > item.add(new AjaxFormComponentUpdatingBehavior("onchange")
> > >
> > > { protected void onUpdate(AjaxRequestTarget target) {...}});
> > >
> > >
> > > thelist.add(item); //!!
> > >
> > > ...
> > >
> > > target.appendJavaScript(js);
> > >
> > > }
> > >
> > >
> > >
> > > thanks
> > >
> > > Wayne
> > >
> >
>
>
>
> --
> La vie est source de joie, la mort est source de paix, seule la transition
> est difficile.
>

Re: Is this possible?

Posted by Zala Pierre GOUPIL <go...@gmail.com>.
You can try wicket-quickview, which is based on the stuff in the link
Martin provided. It works pretty well IMHO, and it is Wicket 6.0 compliant:

https://github.com/vineetsemwal/quickview

Regards,

Pierre





On Thu, Oct 16, 2014 at 6:28 PM, Martin Grigorov <mg...@apache.org>
wrote:

> Hi,
>
> I'd recommend you to use JS for something like this.
> See
>
> http://wicketinaction.com/2008/10/repainting-only-newly-created-repeater-items-via-ajax/
> .
> Additionally I'd recommend to use event delegation, i.e. one change
> listener on the dataview that handles 'change' for all items.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Thu, Oct 16, 2014 at 7:09 PM, Wayne W <wa...@gmail.com>
> wrote:
>
> > We have a page that has a rather big DataView list. We need to be able to
> > make insertions and removals of this list without sending back the whole
> > list via AJAX as its a bit slow over the wire.
> >
> > Is it possible to add a new element and return and insert that into the
> > list? Obviously we could insert in new item with JS on the page but we
> > still want to take advantage to any handlers in wicket for that new item
> > inserted into the list.
> >
> > So something like:
> >
> > ....onSubmit(AjaxRequestTarget target)
> >
> > {
> >
> > Item<MyModel> item = new Item(); //!!
> >
> > item.add(new AjaxFormComponentUpdatingBehavior("onchange")
> >
> > { protected void onUpdate(AjaxRequestTarget target) {...}});
> >
> >
> > thelist.add(item); //!!
> >
> > ...
> >
> > target.appendJavaScript(js);
> >
> > }
> >
> >
> >
> > thanks
> >
> > Wayne
> >
>



-- 
La vie est source de joie, la mort est source de paix, seule la transition
est difficile.

Re: Is this possible?

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

I'd recommend you to use JS for something like this.
See
http://wicketinaction.com/2008/10/repainting-only-newly-created-repeater-items-via-ajax/
.
Additionally I'd recommend to use event delegation, i.e. one change
listener on the dataview that handles 'change' for all items.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Oct 16, 2014 at 7:09 PM, Wayne W <wa...@gmail.com>
wrote:

> We have a page that has a rather big DataView list. We need to be able to
> make insertions and removals of this list without sending back the whole
> list via AJAX as its a bit slow over the wire.
>
> Is it possible to add a new element and return and insert that into the
> list? Obviously we could insert in new item with JS on the page but we
> still want to take advantage to any handlers in wicket for that new item
> inserted into the list.
>
> So something like:
>
> ....onSubmit(AjaxRequestTarget target)
>
> {
>
> Item<MyModel> item = new Item(); //!!
>
> item.add(new AjaxFormComponentUpdatingBehavior("onchange")
>
> { protected void onUpdate(AjaxRequestTarget target) {...}});
>
>
> thelist.add(item); //!!
>
> ...
>
> target.appendJavaScript(js);
>
> }
>
>
>
> thanks
>
> Wayne
>