I’m tring to create a search based on date.
I’ve tried so many different way to repaint a Ajax table with listview.
the listview works fine while I use is loading the page —
but when Try to add it to ajaxsubmit buttun –
I have the markup created for example -18 new row is created – but data is not there.
So the question is how do I add data in the ajax enabled listview tags?
===================
final ListView logTableListView = new ListView<SyslogParsed>("List"){
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(ListItem<SyslogParsed> item) {
//SyslogParsed sp = item.getModelObject();
item.add(new Label("col1"));
item.add(new Label("col2" ));
item.add(new Label("col3") );
item.add(new Label("col4" ));
}
};
final PropertyModel<List<SyslogParsed>> sysLogPropertyModel = new PropertyModel<List<SyslogParsed>>(this, "Dao.findAll");
wmc.setOutputMarkupId(true);
wmc.add(logTableListView);
add(wmc);
logTableListView.setReuseItems(true);
sysLogSearchForm.add(new AjaxSubmitLink("submit"){
private static final long serialVersionUID = 1L;
@SuppressWarnings("unchecked")
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
List<?> allLog = syslogParsedDao.findAll();
logTableListView.setList(allLog); logTableListView.modelChanged();
target.add(wmc);
}
});
===============
<table class="sortable" wicket:id="listContainer">
<tr>
<th> col 1</th>
<th> col2</th>
<th>col 3 </th>
<th> col 4</th>
</tr>
<tr wicket:id="List">
<td wicket:id="col1" > </td>
<td wicket:id="col2"> </td>
<td wicket:id="col3"> </td>
<td wicket:id="col4"> </td>
</tr>
</table>
</wicket:extend>
I don’t see where you are actually setting the lists model. try to instantiate the propertymodel first, then construct the listview like
The propertymodel will then call
this.getDAO().getFindAll()in this instance. Therefore it looks like you data will never be found, moreover the listview does not have any modelobject and will not notify any changes.You can try using an AbstractReadonlyModel like
and adding the listviews container to the ajaxrequesttarget in your submit method. Every time you are rerender the view, the models getObject will be called and the listview is getting the refreshed data.