You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by zoran <je...@gmail.com> on 2010/08/27 23:20:47 UTC

How to refresh ListView on ModalWindow

Hi,

I have a list of products containing a link that should show a user comments
on each product in a modal window. I created a ModalWindow containing a
Panel. I send a list containing comments to this panel. I'm using a ListView
to show this comments e.g:

	ListView eachComment=new ListView("eachComment", commentsList){
				
			@Override
			protected void populateItem(ListItem item) {
				Comment comment=(Comment) item.getModelObject();
				item.add(new Label("commentContent",comment.getContent()));
			}
		};

First time I select some product, the list is created in appropriate way.
However, when I close that ModalWindow and open another one for different
product, the first list is shown again. CommentsList containing the comments
is updated before populateItem is called, but it seems that I should make
something more. Do you have any suggestions?

Zoran
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-refresh-ListView-on-ModalWindow-tp2341639p2341639.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to refresh ListView on ModalWindow

Posted by zoran <je...@gmail.com>.
Hi Sven,

Thank you for suggestion. This works.

Best,
Zoran
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-refresh-ListView-on-ModalWindow-tp2341639p2398942.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: How to refresh ListView on ModalWindow

Posted by Sven Meier <sv...@meiers.net>.
Hi,

you're pushing your comments into the ListView.
Obviously changing the "commentsList" variable afterwards has no effect 
on what the ListView is iterating over.

To keep the comments up-to-date, use a model:

	ListView eachComment=new ListView("eachComment", new PropertyModel(this, "commentsList")){

HTH

Sven

On 08/27/2010 11:20 PM, zoran wrote:
> Hi,
>
> I have a list of products containing a link that should show a user comments
> on each product in a modal window. I created a ModalWindow containing a
> Panel. I send a list containing comments to this panel. I'm using a ListView
> to show this comments e.g:
>
> 	ListView eachComment=new ListView("eachComment", commentsList){
> 				
> 			@Override
> 			protected void populateItem(ListItem item) {
> 				Comment comment=(Comment) item.getModelObject();
> 				item.add(new Label("commentContent",comment.getContent()));
> 			}
> 		};
>
> First time I select some product, the list is created in appropriate way.
> However, when I close that ModalWindow and open another one for different
> product, the first list is shown again. CommentsList containing the comments
> is updated before populateItem is called, but it seems that I should make
> something more. Do you have any suggestions?
>
> Zoran
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org