You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Matthias Keller <ma...@ergon.ch> on 2009/04/08 11:26:00 UTC

Search results in a DataView must be updated

Hi

I implemented a search form which contacts a remote server to search for 
some users and returns a List of the matching users.
I then feed them into a DataView where the user can click on a specific 
entry to see the details.
This is implemented using something like
> public void populateItem (final Item item) {
>     item.add(new Link("link.userDetails") {
>         public void onClick () {
>             setResponsePage(new UserDetailsPage((User) 
> item.getModelObject(), SearchUserPage.this));
>         }
>     });
> }
The SearchUserPage instance is passed to the UserDetailsPage in order to 
have a link there pointing back to the SearchUserPage.

The UserDetailsPage now has a few actions like 'lock user' which locks 
the user on the backend and I finally get the updated instance of the 
User back.
Now my question is, how can I feed it back into the DataView and all that?
Unfortunately, DataView is backed by a ListDataProvider which takes the 
list as a List and not as a model and the UserDetailsPage also has a 
direct reference to the (old) User instance...

Is there a better way to do this which would take care of an updated 
model automatically? So that I would only have to replace the old User 
instance by the new instance in a list, call a  modelChanged()  
somewhere and I'm good?

Thanks for your pointers

Matt

-- 
matthias.keller@ergon.ch  +41 44 268 83 98
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Zürich
http://www.ergon.ch
______________________________________________________________
e r g o n    smart people - smart software

Ergon ist im Final für den Fairnesspreis 2009 - Online-Abstimmung bis 6. Mai 2009 unter www.fairnesspreis.ch