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 <[email protected]> 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 >
