Re: How reRender a component from parent page?
I try this again using only setOutputMarkupId without modelChanged and onModelChange, and don't work. I just setOutputMarkupId on my component and in the ajaxEvent i put: target.addComponent(getPage().get(header:counter)); header is a panel and counter is a Label in this panel. Thanks All. 2010/2/8 Rangel Preis rangel...@gmail.com: Thanks, Don but this don't work the value don't change. And I call setOutputMarkupId when i build it. and call it again later... Thanks All. 2010/2/8 Don Ferguson d...@rixty.com: I think setOutputMarkupId() should have been called earlier, in the MyTemplate constructor when the Header was constructed. Ajax processing needs the markup id to find the component you're changing, so setting it in onModelChanged() is too late. Also, I don't think you need the call to modelChanged() or to override onModelChanged. Changing the model object and adding the component to the target should be sufficient. -Don On Feb 8, 2010, at 2:16 AM, Rangel Preis wrote: My template HTML html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket=http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd; head title wicket:id=title/title meta wicket:id=description name=description content=/ meta wicket:id=keywords name=keywords content=/ meta wicket:id=version name=version content=/ /head body a href=#irconteudo style=display: none;/a div wicket:id=header class=header/div !-- conteudo -- div id=conteudo table class=layout tr td wicket:id=col_esq class=col_esq/ td a name=irconteudo style=display: none;/a div wicket:id=feedback id=feedback/ wicket:child/ /td td class=col_dir /td /tr /table /div div wicket:id=footer class=footer/div /body /html Header.html wicket:panel div class=right div wicket:id=header_client class=client/div /div //Value that i want to change div class=conter a wicket:id=conterspan wicket:id=itens//a /div div class=left a wicket:id=header_home_linkdiv class=logo//a /div div wicket:id=header_search class=search/div /wicket:panel Thanks. 2010/2/5 Riyad Kalla rka...@gmail.com: What do the tasty HTML bits look like? (wicket:ids and what not) On Fri, Feb 5, 2010 at 12:50 PM, Rangel Preis rangel...@gmail.com wrote: How can I use Ajax to change value from a parent page in my layout. I try to change values in header using a action from content page. I have this: |---| | HEADER | |---| | MENU | CONTENT | | | | | | | | | | |---|---| | FOOTER | |---| public class MyTemplate{ public MyTemplate() { super(); this.add(CSSPackageResource.getHeaderContribution(...); this.add(AbstractTemplatePage.FEEDBACK); this.addOrReplace(new Header()); this.add(new Menu()); this.add(new Footer()); . public class MyContetPage extends MyTemplate { public MyContetPage(final PageParameters _parameters) { add(new AjaxFallbackLinkVoid(rem) { �...@override public void onClick(final AjaxRequestTarget target) { …... } }); …. } } How change value in the header when i click on the ajaxlink of my content page? In the onClick i try this; but don't work //some function to change the model value... this.getPage().get(header:component).modelChanged(); target.addComponent(this.getPage().get(header:component)); And in my Header.java I override onModelChanged: protected void onModelChanged() { super.onModelChanged(); this.addOrReplace(component).setOutputMarkupId(true)); } Thanks all. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For
Re: How reRender a component from parent page?
The problem are in HomePage.java in the onClick... this don't reRender my componente in the header. Are you sure? The real problem seems that your itens label uses an implicit model based on the constructor-time value of getAmount(), and which is never changed. Look into using a model instead, e.g. a StringResourceModel with a substitution based on a PropertyModel that gets the amount from the cart. - Tor Iver - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How reRender a component from parent page?
Rangel, The is a common problem people encounter while they get their head aroung Wicket models. In your Header class, the label's data is only ever calculated once, on construction of the Header and is therefore is fixed. Try something like: final Label itens = new Label(itens, new PropertyModel(WicketSession.get(),cart.amount)); (I have retained your spelling of itens but I assume this should be items). If you want to format the resulting string (as per your apparent intention in your QuickStart), use a converter, probably best in your case by overriding the your label's getConverter method. The rest of your code looks OK. Does that make sense? Regards - Cemal jWeekend OO Java Technologies, Wicket Consulting, Development, Training http://jWeekend.com On 9 February 2010 14:50, Rangel Preis rangel...@gmail.com wrote: I make a quick start project (maven) to show my problem, if someone have time... The problem are in HomePage.java in the onClick... this don't reRender my componente in the header. Thanks. 2010/2/9 Rangel Preis rangel...@gmail.com: I try this again using only setOutputMarkupId without modelChanged and onModelChange, and don't work. I just setOutputMarkupId on my component and in the ajaxEvent i put: target.addComponent(getPage().get(header:counter)); header is a panel and counter is a Label in this panel. Thanks All. 2010/2/8 Rangel Preis rangel...@gmail.com: Thanks, Don but this don't work the value don't change. And I call setOutputMarkupId when i build it. and call it again later... Thanks All. 2010/2/8 Don Ferguson d...@rixty.com: I think setOutputMarkupId() should have been called earlier, in the MyTemplate constructor when the Header was constructed. Ajax processing needs the markup id to find the component you're changing, so setting it in onModelChanged() is too late. Also, I don't think you need the call to modelChanged() or to override onModelChanged. Changing the model object and adding the component to the target should be sufficient. -Don On Feb 8, 2010, at 2:16 AM, Rangel Preis wrote: My template HTML html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket=http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd; head title wicket:id=title/title meta wicket:id=description name=description content=/ meta wicket:id=keywords name=keywords content=/ meta wicket:id=version name=version content=/ /head body a href=#irconteudo style=display: none;/a div wicket:id=header class=header/div !-- conteudo -- div id=conteudo table class=layout tr td wicket:id=col_esq class=col_esq/ td a name=irconteudo style=display: none;/a div wicket:id=feedback id=feedback/ wicket:child/ /td td class=col_dir /td /tr /table /div div wicket:id=footer class=footer/div /body /html Header.html wicket:panel div class=right div wicket:id=header_client class=client/div /div //Value that i want to change div class=conter a wicket:id=conterspan wicket:id=itens//a /div div class=left a wicket:id=header_home_linkdiv class=logo//a /div div wicket:id=header_search class=search/div /wicket:panel Thanks. 2010/2/5 Riyad Kalla rka...@gmail.com: What do the tasty HTML bits look like? (wicket:ids and what not) On Fri, Feb 5, 2010 at 12:50 PM, Rangel Preis rangel...@gmail.com wrote: How can I use Ajax to change value from a parent page in my layout. I try to change values in header using a action from content page. I have this: |---| | HEADER | |---| | MENU | CONTENT | | | | | | | | | | |---|---| | FOOTER | |---| public class MyTemplate{ public MyTemplate() { super(); this.add(CSSPackageResource.getHeaderContribution(...); this.add(AbstractTemplatePage.FEEDBACK); this.addOrReplace(new Header()); this.add(new Menu()); this.add(new Footer()); . public class MyContetPage extends MyTemplate { public MyContetPage(final PageParameters _parameters) { add(new AjaxFallbackLinkVoid(rem) { �...@override public void
Re: How reRender a component from parent page?
Yes, it's make sense. I change to ptopertyModel and now thinks works. Thanks Cemal. 2010/2/9 Cemal Bayramoglu jweekend_for...@cabouge.com: Rangel, The is a common problem people encounter while they get their head aroung Wicket models. In your Header class, the label's data is only ever calculated once, on construction of the Header and is therefore is fixed. Try something like: final Label itens = new Label(itens, new PropertyModel(WicketSession.get(),cart.amount)); (I have retained your spelling of itens but I assume this should be items). If you want to format the resulting string (as per your apparent intention in your QuickStart), use a converter, probably best in your case by overriding the your label's getConverter method. The rest of your code looks OK. Does that make sense? Regards - Cemal jWeekend OO Java Technologies, Wicket Consulting, Development, Training http://jWeekend.com On 9 February 2010 14:50, Rangel Preis rangel...@gmail.com wrote: I make a quick start project (maven) to show my problem, if someone have time... The problem are in HomePage.java in the onClick... this don't reRender my componente in the header. Thanks. 2010/2/9 Rangel Preis rangel...@gmail.com: I try this again using only setOutputMarkupId without modelChanged and onModelChange, and don't work. I just setOutputMarkupId on my component and in the ajaxEvent i put: target.addComponent(getPage().get(header:counter)); header is a panel and counter is a Label in this panel. Thanks All. 2010/2/8 Rangel Preis rangel...@gmail.com: Thanks, Don but this don't work the value don't change. And I call setOutputMarkupId when i build it. and call it again later... Thanks All. 2010/2/8 Don Ferguson d...@rixty.com: I think setOutputMarkupId() should have been called earlier, in the MyTemplate constructor when the Header was constructed. Ajax processing needs the markup id to find the component you're changing, so setting it in onModelChanged() is too late. Also, I don't think you need the call to modelChanged() or to override onModelChanged. Changing the model object and adding the component to the target should be sufficient. -Don On Feb 8, 2010, at 2:16 AM, Rangel Preis wrote: My template HTML html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket=http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd; head title wicket:id=title/title meta wicket:id=description name=description content=/ meta wicket:id=keywords name=keywords content=/ meta wicket:id=version name=version content=/ /head body a href=#irconteudo style=display: none;/a div wicket:id=header class=header/div !-- conteudo -- div id=conteudo table class=layout tr td wicket:id=col_esq class=col_esq/ td a name=irconteudo style=display: none;/a div wicket:id=feedback id=feedback/ wicket:child/ /td td class=col_dir /td /tr /table /div div wicket:id=footer class=footer/div /body /html Header.html wicket:panel div class=right div wicket:id=header_client class=client/div /div //Value that i want to change div class=conter a wicket:id=conterspan wicket:id=itens//a /div div class=left a wicket:id=header_home_linkdiv class=logo//a /div div wicket:id=header_search class=search/div /wicket:panel Thanks. 2010/2/5 Riyad Kalla rka...@gmail.com: What do the tasty HTML bits look like? (wicket:ids and what not) On Fri, Feb 5, 2010 at 12:50 PM, Rangel Preis rangel...@gmail.com wrote: How can I use Ajax to change value from a parent page in my layout. I try to change values in header using a action from content page. I have this: |---| | HEADER | |---| | MENU | CONTENT | | | | | | | | | | |---|---| | FOOTER | |---| public class MyTemplate{ public MyTemplate() { super(); this.add(CSSPackageResource.getHeaderContribution(...); this.add(AbstractTemplatePage.FEEDBACK); this.addOrReplace(new Header()); this.add(new Menu()); this.add(new Footer()); . public class
Re: How reRender a component from parent page?
My template HTML html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket=http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd; head title wicket:id=title/title meta wicket:id=description name=description content=/ meta wicket:id=keywords name=keywords content=/ meta wicket:id=version name=version content=/ /head body a href=#irconteudo style=display: none;/a div wicket:id=header class=header/div !-- conteudo -- div id=conteudo table class=layout tr td wicket:id=col_esq class=col_esq/ td a name=irconteudo style=display: none;/a div wicket:id=feedback id=feedback/ wicket:child/ /td td class=col_dir /td /tr /table /div div wicket:id=footer class=footer/div /body /html Header.html wicket:panel div class=right div wicket:id=header_client class=client/div /div //Value that i want to change div class=conter a wicket:id=conterspan wicket:id=itens//a /div div class=left a wicket:id=header_home_linkdiv class=logo//a /div div wicket:id=header_search class=search/div /wicket:panel Thanks. 2010/2/5 Riyad Kalla rka...@gmail.com: What do the tasty HTML bits look like? (wicket:ids and what not) On Fri, Feb 5, 2010 at 12:50 PM, Rangel Preis rangel...@gmail.com wrote: How can I use Ajax to change value from a parent page in my layout. I try to change values in header using a action from content page. I have this: |---| | HEADER | |---| | MENU | CONTENT | | | | | | | | | | |---|---| | FOOTER | |---| public class MyTemplate{ public MyTemplate() { super(); this.add(CSSPackageResource.getHeaderContribution(...); this.add(AbstractTemplatePage.FEEDBACK); this.addOrReplace(new Header()); this.add(new Menu()); this.add(new Footer()); . public class MyContetPage extends MyTemplate { public MyContetPage(final PageParameters _parameters) { add(new AjaxFallbackLinkVoid(rem) { �...@override public void onClick(final AjaxRequestTarget target) { …... } }); …. } } How change value in the header when i click on the ajaxlink of my content page? In the onClick i try this; but don't work //some function to change the model value... this.getPage().get(header:component).modelChanged(); target.addComponent(this.getPage().get(header:component)); And in my Header.java I override onModelChanged: protected void onModelChanged() { super.onModelChanged(); this.addOrReplace(component).setOutputMarkupId(true)); } Thanks all. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How reRender a component from parent page?
I think setOutputMarkupId() should have been called earlier, in the MyTemplate constructor when the Header was constructed. Ajax processing needs the markup id to find the component you're changing, so setting it in onModelChanged() is too late. Also, I don't think you need the call to modelChanged() or to override onModelChanged. Changing the model object and adding the component to the target should be sufficient. -Don On Feb 8, 2010, at 2:16 AM, Rangel Preis wrote: My template HTML html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket=http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd head title wicket:id=title/title meta wicket:id=description name=description content=/ meta wicket:id=keywords name=keywords content=/ meta wicket:id=version name=version content=/ /head body a href=#irconteudo style=display: none;/a div wicket:id=header class=header/div !-- conteudo -- div id=conteudo table class=layout tr td wicket:id=col_esq class=col_esq/ td a name=irconteudo style=display: none;/a div wicket:id=feedback id=feedback/ wicket:child/ /td td class=col_dir /td /tr /table /div div wicket:id=footer class=footer/div /body /html Header.html wicket:panel div class=right div wicket:id=header_client class=client/div /div //Value that i want to change div class=conter a wicket:id=conterspan wicket:id=itens//a /div div class=left a wicket:id=header_home_linkdiv class=logo//a /div div wicket:id=header_search class=search/div /wicket:panel Thanks. 2010/2/5 Riyad Kalla rka...@gmail.com: What do the tasty HTML bits look like? (wicket:ids and what not) On Fri, Feb 5, 2010 at 12:50 PM, Rangel Preis rangel...@gmail.com wrote: How can I use Ajax to change value from a parent page in my layout. I try to change values in header using a action from content page. I have this: |---| | HEADER | |---| | MENU | CONTENT | | | | | | | | | | |---|---| | FOOTER| |---| public class MyTemplate{ public MyTemplate() { super(); this.add(CSSPackageResource.getHeaderContribution(...); this.add(AbstractTemplatePage.FEEDBACK); this.addOrReplace(new Header()); this.add(new Menu()); this.add(new Footer()); . public class MyContetPage extends MyTemplate { public MyContetPage(final PageParameters _parameters) { add(new AjaxFallbackLinkVoid(rem) { @Override public void onClick(final AjaxRequestTarget target) { …... } }); …. } } How change value in the header when i click on the ajaxlink of my content page? In the onClick i try this; but don't work //some function to change the model value... this.getPage().get(header:component).modelChanged(); target.addComponent(this.getPage().get(header:component)); And in my Header.java I override onModelChanged: protected void onModelChanged() { super.onModelChanged(); this.addOrReplace(component).setOutputMarkupId(true)); } Thanks all. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How reRender a component from parent page?
Thanks, Don but this don't work the value don't change. And I call setOutputMarkupId when i build it. and call it again later... Thanks All. 2010/2/8 Don Ferguson d...@rixty.com: I think setOutputMarkupId() should have been called earlier, in the MyTemplate constructor when the Header was constructed. Ajax processing needs the markup id to find the component you're changing, so setting it in onModelChanged() is too late. Also, I don't think you need the call to modelChanged() or to override onModelChanged. Changing the model object and adding the component to the target should be sufficient. -Don On Feb 8, 2010, at 2:16 AM, Rangel Preis wrote: My template HTML html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket=http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd; head title wicket:id=title/title meta wicket:id=description name=description content=/ meta wicket:id=keywords name=keywords content=/ meta wicket:id=version name=version content=/ /head body a href=#irconteudo style=display: none;/a div wicket:id=header class=header/div !-- conteudo -- div id=conteudo table class=layout tr td wicket:id=col_esq class=col_esq/ td a name=irconteudo style=display: none;/a div wicket:id=feedback id=feedback/ wicket:child/ /td td class=col_dir /td /tr /table /div div wicket:id=footer class=footer/div /body /html Header.html wicket:panel div class=right div wicket:id=header_client class=client/div /div //Value that i want to change div class=conter a wicket:id=conterspan wicket:id=itens//a /div div class=left a wicket:id=header_home_linkdiv class=logo//a /div div wicket:id=header_search class=search/div /wicket:panel Thanks. 2010/2/5 Riyad Kalla rka...@gmail.com: What do the tasty HTML bits look like? (wicket:ids and what not) On Fri, Feb 5, 2010 at 12:50 PM, Rangel Preis rangel...@gmail.com wrote: How can I use Ajax to change value from a parent page in my layout. I try to change values in header using a action from content page. I have this: |---| | HEADER | |---| | MENU | CONTENT | | | | | | | | | | |---|---| | FOOTER | |---| public class MyTemplate{ public MyTemplate() { super(); this.add(CSSPackageResource.getHeaderContribution(...); this.add(AbstractTemplatePage.FEEDBACK); this.addOrReplace(new Header()); this.add(new Menu()); this.add(new Footer()); . public class MyContetPage extends MyTemplate { public MyContetPage(final PageParameters _parameters) { add(new AjaxFallbackLinkVoid(rem) { �...@override public void onClick(final AjaxRequestTarget target) { …... } }); …. } } How change value in the header when i click on the ajaxlink of my content page? In the onClick i try this; but don't work //some function to change the model value... this.getPage().get(header:component).modelChanged(); target.addComponent(this.getPage().get(header:component)); And in my Header.java I override onModelChanged: protected void onModelChanged() { super.onModelChanged(); this.addOrReplace(component).setOutputMarkupId(true)); } Thanks all. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe,
How reRender a component from parent page?
How can I use Ajax to change value from a parent page in my layout. I try to change values in header using a action from content page. I have this: |---| | HEADER | |---| | MENU | CONTENT | | | | | | | | | | |---|---| | FOOTER| |---| public class MyTemplate{ public MyTemplate() { super(); this.add(CSSPackageResource.getHeaderContribution(...); this.add(AbstractTemplatePage.FEEDBACK); this.addOrReplace(new Header()); this.add(new Menu()); this.add(new Footer()); . public class MyContetPage extends MyTemplate { public MyContetPage(final PageParameters _parameters) { add(new AjaxFallbackLinkVoid(rem) { �...@override public void onClick(final AjaxRequestTarget target) { …... } }); …. } } How change value in the header when i click on the ajaxlink of my content page? In the onClick i try this; but don't work //some function to change the model value... this.getPage().get(header:component).modelChanged(); target.addComponent(this.getPage().get(header:component)); And in my Header.java I override onModelChanged: protected void onModelChanged() { super.onModelChanged(); this.addOrReplace(component).setOutputMarkupId(true)); } Thanks all. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How reRender a component from parent page?
What do the tasty HTML bits look like? (wicket:ids and what not) On Fri, Feb 5, 2010 at 12:50 PM, Rangel Preis rangel...@gmail.com wrote: How can I use Ajax to change value from a parent page in my layout. I try to change values in header using a action from content page. I have this: |---| | HEADER | |---| | MENU | CONTENT | | | | | | | | | | |---|---| | FOOTER | |---| public class MyTemplate{ public MyTemplate() { super(); this.add(CSSPackageResource.getHeaderContribution(...); this.add(AbstractTemplatePage.FEEDBACK); this.addOrReplace(new Header()); this.add(new Menu()); this.add(new Footer()); . public class MyContetPage extends MyTemplate { public MyContetPage(final PageParameters _parameters) { add(new AjaxFallbackLinkVoid(rem) { �...@override public void onClick(final AjaxRequestTarget target) { …... } }); …. } } How change value in the header when i click on the ajaxlink of my content page? In the onClick i try this; but don't work //some function to change the model value... this.getPage().get(header:component).modelChanged(); target.addComponent(this.getPage().get(header:component)); And in my Header.java I override onModelChanged: protected void onModelChanged() { super.onModelChanged(); this.addOrReplace(component).setOutputMarkupId(true)); } Thanks all. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org