java - Wicket replacing items in ListView -
i want alter info of listview on button click.
this currently:
final pageablelistview<users> listview = new pageablelistview<users>("rows", displaylist, 10) { //.... protected void populateitem(final listitem<users> item) { item.add(new label("username").setoutputmarkupid(true)); // .. other fields } } final indicatingajaxfallbacklink<mypanel> sublist = new indicatingajaxfallbacklink<mypanel>("sublist") { public void onclick(ajaxrequesttarget target) { displaylist = // new list listview.setlist(displaylist); target.addchildren(listview, label.class); } }; add(sublist);
this works if new list same size old list. in other case an
caused by: java.lang.indexoutofboundsexception: index: 1, size: 1
how can prepare problem?
since can't update listview via target.add(listview);
added webmarkupcontainer
this:
final webmarkupcontainer datacontainer = new webmarkupcontainer("data"); datacontainer.setoutputmarkupid(true); add(datacontainer);
and can update onclick
method:
target.add(datacontainer);
this works fine - problem solved.
but why replacing children didn't work still unclear me
java listview wicket
No comments:
Post a Comment