You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Dmitriy Neretin <dm...@googlemail.com> on 2011/03/01 09:51:58 UTC
Panel update after Ajax Submit
Hello everybody!
Hope someone can help me. I don't really understand, what I should add as
ajax target :(
So, I have an abstract class Index where I add all my panels (3) and it is
my "masterlayout". I add the panels in the index class like this:
add(new ShoppingCartPanel("id", "anotherMehod");
The appropriate Markup has just following tags (ShoppingCartPanel.html):
<wicket:panel>
Content
</wicketpanel>
In the other Page (that inherits from Index) I have implemented the
AjaxSubmitLink:
add(new AjaxSubmitLink("addtocart") {
@Override
protected void onSubmit(AjaxRequestTarget target, Form form) {
target.addComponent(?????????????????);
What I want is, when the link is activated the panel should be updated...
First: I don't really understand what I have add to the addComponent()
method ?
Second: Where schould I set setOutputMarupId(true) ?
Thank You!
Re: Panel update after Ajax Submit
Posted by Zoltán Nagy <zb...@gmail.com>.
Hi!
2011/3/1 Dmitriy Neretin <dm...@googlemail.com>:
> Thanks for reply,
>
> If you want to refresh the panel, call setOutputMarkupId(true) on the panel
>> , then add the panel to the target.
>>
>
> Does it mean I should call setOutputMarkUpId(true) in the constructor of the
> panel? If I do so, the layout of the panel is destroyed.
>
>
You should set it before you first send out the component (normal
pageRender or in on ajax response). You can set it in the constructor
or some time before Rendering.
--
Zoltán Nagy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Panel update after Ajax Submit
Posted by Dmitriy Neretin <dm...@googlemail.com>.
No, the panel is outside! What I just want, is that the panel shows me the
result of the submit.
But I did it :)
Hier is my solution:
1. Call in the constructor of the panel setOutputMarkUpId(true);
2. Instantiate the panel Class in the abstract Class (masterlayout) as field
and return it back with a simple getter.
3. In the AjaxSubmitLink: target.addComponent(call the getter from an
abstract class);
I don't know, if it was right, but it works now :)
What do the experts mean?
On 1 March 2011 14:04, Pedro Santos <pe...@gmail.com> wrote:
> Hi, if you update the panel within the form, you need to update it's submit
> link component outside this panel also.
> onsubmit(target){
> target.addComponent(formPanel);
> target.addComponent(submitLinkNotNestedInsideTheFormPanel);
> }
>
> On Tue, Mar 1, 2011 at 9:51 AM, Dmitriy Neretin <
> dmitriy.neretin@googlemail.com> wrote:
>
> > Thanks for reply,
> >
> > If you want to refresh the panel, call setOutputMarkupId(true) on the
> > panel
> > > , then add the panel to the target.
> > >
> >
> > Does it mean I should call setOutputMarkUpId(true) in the constructor of
> > the
> > panel? If I do so, the layout of the panel is destroyed.
> >
> >
> > > If the Ajax Link is on the same panel, you can call
> > > this.setOutputMarkupId(true) , and you can also add MyPanel.this to the
> > > target.
> > >
> >
> > No, the link is not on the same panel. This is actually the point that I
> > don't really understand. What should I add, if the link not on the panel.
> >
> >
> > > The point is , what ever you want to refresh via ajax must have
> > > outputMarkupId set to true.
> > >
> > > Hope that helps.
> > >
> > > Josh.
> > >
> > > On Tue, Mar 1, 2011 at 11:51 AM, Dmitriy Neretin <
> > > dmitriy.neretin@googlemail.com> wrote:
> > >
> > > > Hello everybody!
> > > >
> > > > Hope someone can help me. I don't really understand, what I should
> add
> > as
> > > > ajax target :(
> > > >
> > > > So, I have an abstract class Index where I add all my panels (3) and
> it
> > > is
> > > > my "masterlayout". I add the panels in the index class like this:
> > > >
> > > > add(new ShoppingCartPanel("id", "anotherMehod");
> > > >
> > > > The appropriate Markup has just following tags
> > (ShoppingCartPanel.html):
> > > > <wicket:panel>
> > > > Content
> > > > </wicketpanel>
> > > >
> > > > In the other Page (that inherits from Index) I have implemented the
> > > > AjaxSubmitLink:
> > > >
> > > > add(new AjaxSubmitLink("addtocart") {
> > > > @Override
> > > > protected void onSubmit(AjaxRequestTarget target, Form
> form)
> > {
> > > > target.addComponent(?????????????????);
> > > >
> > > > What I want is, when the link is activated the panel should be
> > updated...
> > > >
> > > > First: I don't really understand what I have add to the
> addComponent()
> > > > method ?
> > > > Second: Where schould I set setOutputMarupId(true) ?
> > > >
> > > > Thank You!
> > > >
> > >
> >
>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>
Re: Panel update after Ajax Submit
Posted by Pedro Santos <pe...@gmail.com>.
Hi, if you update the panel within the form, you need to update it's submit
link component outside this panel also.
onsubmit(target){
target.addComponent(formPanel);
target.addComponent(submitLinkNotNestedInsideTheFormPanel);
}
On Tue, Mar 1, 2011 at 9:51 AM, Dmitriy Neretin <
dmitriy.neretin@googlemail.com> wrote:
> Thanks for reply,
>
> If you want to refresh the panel, call setOutputMarkupId(true) on the
> panel
> > , then add the panel to the target.
> >
>
> Does it mean I should call setOutputMarkUpId(true) in the constructor of
> the
> panel? If I do so, the layout of the panel is destroyed.
>
>
> > If the Ajax Link is on the same panel, you can call
> > this.setOutputMarkupId(true) , and you can also add MyPanel.this to the
> > target.
> >
>
> No, the link is not on the same panel. This is actually the point that I
> don't really understand. What should I add, if the link not on the panel.
>
>
> > The point is , what ever you want to refresh via ajax must have
> > outputMarkupId set to true.
> >
> > Hope that helps.
> >
> > Josh.
> >
> > On Tue, Mar 1, 2011 at 11:51 AM, Dmitriy Neretin <
> > dmitriy.neretin@googlemail.com> wrote:
> >
> > > Hello everybody!
> > >
> > > Hope someone can help me. I don't really understand, what I should add
> as
> > > ajax target :(
> > >
> > > So, I have an abstract class Index where I add all my panels (3) and it
> > is
> > > my "masterlayout". I add the panels in the index class like this:
> > >
> > > add(new ShoppingCartPanel("id", "anotherMehod");
> > >
> > > The appropriate Markup has just following tags
> (ShoppingCartPanel.html):
> > > <wicket:panel>
> > > Content
> > > </wicketpanel>
> > >
> > > In the other Page (that inherits from Index) I have implemented the
> > > AjaxSubmitLink:
> > >
> > > add(new AjaxSubmitLink("addtocart") {
> > > @Override
> > > protected void onSubmit(AjaxRequestTarget target, Form form)
> {
> > > target.addComponent(?????????????????);
> > >
> > > What I want is, when the link is activated the panel should be
> updated...
> > >
> > > First: I don't really understand what I have add to the addComponent()
> > > method ?
> > > Second: Where schould I set setOutputMarupId(true) ?
> > >
> > > Thank You!
> > >
> >
>
--
Pedro Henrique Oliveira dos Santos
Re: Panel update after Ajax Submit
Posted by Dmitriy Neretin <dm...@googlemail.com>.
Thanks for reply,
If you want to refresh the panel, call setOutputMarkupId(true) on the panel
> , then add the panel to the target.
>
Does it mean I should call setOutputMarkUpId(true) in the constructor of the
panel? If I do so, the layout of the panel is destroyed.
> If the Ajax Link is on the same panel, you can call
> this.setOutputMarkupId(true) , and you can also add MyPanel.this to the
> target.
>
No, the link is not on the same panel. This is actually the point that I
don't really understand. What should I add, if the link not on the panel.
> The point is , what ever you want to refresh via ajax must have
> outputMarkupId set to true.
>
> Hope that helps.
>
> Josh.
>
> On Tue, Mar 1, 2011 at 11:51 AM, Dmitriy Neretin <
> dmitriy.neretin@googlemail.com> wrote:
>
> > Hello everybody!
> >
> > Hope someone can help me. I don't really understand, what I should add as
> > ajax target :(
> >
> > So, I have an abstract class Index where I add all my panels (3) and it
> is
> > my "masterlayout". I add the panels in the index class like this:
> >
> > add(new ShoppingCartPanel("id", "anotherMehod");
> >
> > The appropriate Markup has just following tags (ShoppingCartPanel.html):
> > <wicket:panel>
> > Content
> > </wicketpanel>
> >
> > In the other Page (that inherits from Index) I have implemented the
> > AjaxSubmitLink:
> >
> > add(new AjaxSubmitLink("addtocart") {
> > @Override
> > protected void onSubmit(AjaxRequestTarget target, Form form) {
> > target.addComponent(?????????????????);
> >
> > What I want is, when the link is activated the panel should be updated...
> >
> > First: I don't really understand what I have add to the addComponent()
> > method ?
> > Second: Where schould I set setOutputMarupId(true) ?
> >
> > Thank You!
> >
>
Re: Panel update after Ajax Submit
Posted by Josh Kamau <jo...@gmail.com>.
Hi there,
If you want to refresh the panel, call setOutputMarkupId(true) on the panel
, then add the panel to the target.
If the Ajax Link is on the same panel, you can call
this.setOutputMarkupId(true) , and you can also add MyPanel.this to the
target.
The point is , what ever you want to refresh via ajax must have
outputMarkupId set to true.
Hope that helps.
Josh.
On Tue, Mar 1, 2011 at 11:51 AM, Dmitriy Neretin <
dmitriy.neretin@googlemail.com> wrote:
> Hello everybody!
>
> Hope someone can help me. I don't really understand, what I should add as
> ajax target :(
>
> So, I have an abstract class Index where I add all my panels (3) and it is
> my "masterlayout". I add the panels in the index class like this:
>
> add(new ShoppingCartPanel("id", "anotherMehod");
>
> The appropriate Markup has just following tags (ShoppingCartPanel.html):
> <wicket:panel>
> Content
> </wicketpanel>
>
> In the other Page (that inherits from Index) I have implemented the
> AjaxSubmitLink:
>
> add(new AjaxSubmitLink("addtocart") {
> @Override
> protected void onSubmit(AjaxRequestTarget target, Form form) {
> target.addComponent(?????????????????);
>
> What I want is, when the link is activated the panel should be updated...
>
> First: I don't really understand what I have add to the addComponent()
> method ?
> Second: Where schould I set setOutputMarupId(true) ?
>
> Thank You!
>