Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Replacing items in a ListView

$
0
0
I want to change the data of a listview on a Button Click.

This is what I do 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 = // get new list
listview.setList(displayList);
target.addChildren(listview, Label.class);

};
add(sublist);/

This works if the new list is exactly the same size ad the old list. In any
other case I get an

/Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1/

How can I fix this problem?

Viewing all articles
Browse latest Browse all 5648

Trending Articles