Re: [Wicket-user] ajax request does not recreate component with changed model
or just doadd(new Label("currentItemName", new AbstractReadOnlyModel() { Object getObject(Component c) { return currentItem.getName(); }});-IgorOn 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 itemlater, the item container is not recreated, thus the label still showsold 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", newPropertyModel(EnclosingClassName.this, "currentItem.name")));-MatejRyan 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 ITJoin SourceForge.net 's Techsay panel and you'll get the chance to share youropinions 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 ITJoin 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.nethttps://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
Re: [Wicket-user] ajax request does not recreate component with changed model
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 itemlater, the item container is not recreated, thus the label still showsold 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", newPropertyModel(EnclosingClassName.this, "currentItem.name")));-MatejRyan 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 ITJoin SourceForge.net 's Techsay panel and you'll get the chance to share youropinions 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 listWicket-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
Re: [Wicket-user] ajax request does not recreate component with changed model
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
[Wicket-user] ajax request does not recreate component with changed model
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