Hi all.
Rather than overwriting "results", shouldn't the code be more like:
List<CustomFileDescription> results = new
ArrayList<CustomFileDescription>();
final WebMarkupContainer resultcontainer = new
WebMarkupContainer("resultcontainer");
add(resultcontainer.setOutputMarkupId(true));
final ListView<CustomFileDescription> files = new
ListView<CustomFileDescription>("files", results)
{
...
};
resultcontainer.add(files);
...
results.clear();
results.addAll(Arrays.AsList(
fileSearchService.search(query.getDefaultModelObjectAsString()
));
target.addComponent(resultcontainer);
When you create the ListView, pass an instantiated List object (the
Model Object, essentially), and modify the model by adding stuff to it.
-Don
On Dec 5, 2009, at 9:42 PM, local_shamil wrote:
in case if you found the solution, can u plzz reply to the forum
freak182 wrote:
Hello,
For no apparent reason the listview is not updating when i targeted
it. im
using wicket 1.4.1.
here is the code:
final WebMarkupContainer resultcontainer = new
WebMarkupContainer("resultcontainer");
add(resultcontainer.setOutputMarkupId(true));
final ListView<CustomFileDescription> files = new
ListView<CustomFileDescription>("files", results)
{
@Override
protected void populateItem(ListItem<CustomFileDescription>
item)
{
final CustomFileDescription fileDesc = item.getModelObject();
item.setModel(new
CompoundPropertyModel<CustomFileDescription>(fileDesc));
item.add(new Label("name"));
item.add(new Label("lastModified"));
}
};
//files.setReuseItems(true);
resultcontainer.add(files);
final List<CustomFileDescription> results =
fileSearchService.search(query.getDefaultModelObjectAsString());
System.out.println(results.size());
files.setDefaultModelObject(results);
target.addComponent(resultcontainer);
...the results are just appending to each other.
Thanks a lot.
Cheers.
--
View this message in context:
http://old.nabble.com/Update-ListView-using-ajax-tp25310457p26662446.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]