Problem Using DataView (list appears empty) to display a list of Strings

10 views
Skip to first unread message

Haritos Hatzidimitriou

unread,
Feb 25, 2021, 9:37:46 AM2/25/21
to wicket-jquery-ui
Hello Sebastien,

I'm trying to use a DataView to display a list of Strings (using DataViewPanel.class currently) but my list appears empty even thought the pager correctly recognizes that the list contains 6 elements:

Untitled.png
After some trial and error I realized it must be because I don't provide a template
so Kendo doesn't know how to render the list. So looking at the code it seems that I need to override the newTemplate()  method but I'm not sure how to do this.
I tried the following but it's now working:

ListDataProvider<String> dataProvider = new ListDataProvider<>(getGoodsList());

DataViewPanel<String> panel = new DataViewPanel<String>("goodsListView", dataProvider, 20L, options) {

private static final long serialVersionUID = 1L;

protected IJQueryTemplate newTemplate() {

return new IJQueryTemplate() {

private static final long serialVersionUID = 1L;

@Override
public String getText() {
return  "<i>#: data.name #</i>";
}

@Override
public List getTextProperties() {
return Generics.newArrayList();
}
};
}
};

Can you tell me what I'm doing wrong?

Thank you in advance
Haritos

Reply all
Reply to author
Forward
0 new messages