or just do

add(new Label("currentItemName", new AbstractReadOnlyModel() {
 Object getObject(Component c) { return currentItem.getName(); }});

-Igor


On 10/7/06, Ryan Sonnek <[EMAIL PROTECTED]> wrote:
That worked great, thanks!!

I had tried the property model approach, but it didn't work because I wasn't using the EnclosingClass as the "modelObject" 


On 10/7/06, Matej Knopp <[EMAIL PROTECTED]> wrote:
Your problem is that you create label with constant modal, that is set
to the value of currentItem.getName. So even if you change current item
later, the item container is not recreated, thus the label still shows
old current item name.

The solution would be to create the label like this (assuming
currentItem is a member variable of enclosing class:

add(new Label("currentItemName", new
PropertyModel(EnclosingClassName.this, "currentItem.name")));

-Matej

Ryan Sonnek wrote:
> I have a page with a local variable "currentItem".  I'm trying to use an
> ajax request to change that item and refresh a detail panel, but the
> component does not reflect the changes.
>
> AjaxLink link = new AjaxLink("selectItem") {
>   public void onClick(AjaxRequestTarget target) {
>     currentItem = item;
>     target.addComponent(currentItemContainer);
>   }
> };
>
> public class CurrentItemContainer extends WebMarkupContainer {
>   public CurrentItemContainer(String id) {
>     super(id);
>     setOutputMarkupId(true);
>     add(new Label("currentItemName", currentItem.getName()));
>   }
> }
>
> my ajax link fires, and streams back the CurrentItemContainer, but it
> does not have the newly selected item for model.  I'm sure wicket
> supports this somehow, and i've checked through the ajax examples, but I
> haven't come across anything yet.
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net 's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to