You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk> on 2007/08/07 11:02:21 UTC

{wicket 1.3 Beta 2} Adding panel via ajax...

Hi

I have a panel I want to replace by another panel via ajax. However when 
trying to replace the panel I get this message:

WicketMessage: This component is not (yet) coupled to a page. It has to 
be able to find the page it is supposed to operate in before you can 
call this method (Component#getMarkupId)

What should I do to avoid this?

regards Nino



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


Re: {wicket 1.3 Beta 2} Adding panel via ajax...

Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
This is somewhat working as wanted, but feels wrong, since I have to add 
the "next page" panel inorder to be able to show it later on:

    public PhoneSearchPanel(String id, final IPhoneManipulationPanel 
gotoPage) {
        super(id);
        setOutputMarkupId(true);
        Form form = new Form("form");
        final Panel panel = this;
        add(form);
        AutoCompleteTextField phoneName = new AutoCompleteTextField(
                "phoneName", selectedPhone) {
            @Override
            protected Iterator getChoices(String input) {

                return 
SDUTApplication.getService().findPhonesByFilter(input,
                        null, null, null, null, null, null, 
null).iterator();
            }
        };
        form.add(phoneName);

        form.add(new AjaxButton("submit", form) {

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form form) {
                gotoPage.setPhone(selectedPhone);
                ((Component) gotoPage).setVisible(true);
                panel.setVisible(false);
                target.addComponent(panel);
                target.addComponent((Component) gotoPage, 
panel.getMarkupId());
            }

        });
        ((Component) gotoPage).setVisible(false);
        add(((Component) gotoPage));

    }
}


Matej Knopp wrote:
> The error looks like you are trying to render a component that is not
> attached to a page. You can add/remove components as much as you want,
> but when it comes to render, all components have to be attached to the
> page.
>
> -Matej
>
> On 8/7/07, Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk> wrote:
>   
>> Ok, I'll try to explain myself a little better.
>>
>> Im using the tabs from extensions, tabs require that what you work with
>> are panels (otherwise I would have done this with pages).
>>
>> So some of my tabs have a certain flow. Inorder to create that flow I
>> have to replace panels along the way, for example start with the search
>> panel, then replace the search panel with the edit panel.
>>
>> However wicket complains that you cant add the panel via ajax with being
>> attached to a page, and since im replaceing not adding this cant be done?
>>
>> Am I using a wrong approach on this?
>>
>> regards Nino
>>
>> Nino Saturnino Martinez Vazquez Wael wrote:
>>     
>>> Hi
>>>
>>> I have a panel I want to replace by another panel via ajax. However
>>> when trying to replace the panel I get this message:
>>>
>>> WicketMessage: This component is not (yet) coupled to a page. It has
>>> to be able to find the page it is supposed to operate in before you
>>> can call this method (Component#getMarkupId)
>>>
>>> What should I do to avoid this?
>>>
>>> regards Nino
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>   

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


Re: {wicket 1.3 Beta 2} Adding panel via ajax...

Posted by Matej Knopp <ma...@gmail.com>.
The error looks like you are trying to render a component that is not
attached to a page. You can add/remove components as much as you want,
but when it comes to render, all components have to be attached to the
page.

-Matej

On 8/7/07, Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk> wrote:
> Ok, I'll try to explain myself a little better.
>
> Im using the tabs from extensions, tabs require that what you work with
> are panels (otherwise I would have done this with pages).
>
> So some of my tabs have a certain flow. Inorder to create that flow I
> have to replace panels along the way, for example start with the search
> panel, then replace the search panel with the edit panel.
>
> However wicket complains that you cant add the panel via ajax with being
> attached to a page, and since im replaceing not adding this cant be done?
>
> Am I using a wrong approach on this?
>
> regards Nino
>
> Nino Saturnino Martinez Vazquez Wael wrote:
> > Hi
> >
> > I have a panel I want to replace by another panel via ajax. However
> > when trying to replace the panel I get this message:
> >
> > WicketMessage: This component is not (yet) coupled to a page. It has
> > to be able to find the page it is supposed to operate in before you
> > can call this method (Component#getMarkupId)
> >
> > What should I do to avoid this?
> >
> > regards Nino
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: {wicket 1.3 Beta 2} Adding panel via ajax...

Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Of course:)

This goes wrong:

What I would like from below was for it to replace the PhoneSearchPanel 
with the next step (gotoPage)

Now I have to use panel since im using the tabs from extension, 
originally I created this with pages..

I've though of having a container(which also would be a panel) which 
could keep track of panels instead, im not sure that would work better?

public PhoneSearchPanel(String id, final IPhoneManipulationPanel 
gotoPage) {
       super(id);
       setOutputMarkupId(true);
       Form form = new Form("form");
       final Panel panel = this;
       add(form);
       AutoCompleteTextField phoneName = new AutoCompleteTextField(
               "phoneName", selectedPhone) {
           @Override
           protected Iterator getChoices(String input) {

               return 
SDUTApplication.getService().findPhonesByFilter(input,
                       null, null, null, null, null, null, 
null).iterator();
           }
       };
       form.add(phoneName);

       form.add(new AjaxButton("submit", form) {

           @Override
           protected void onSubmit(AjaxRequestTarget target, Form form) {
               gotoPage.setPhone(selectedPhone);
               target.addComponent((Component) gotoPage, 
panel.getMarkupId());
           }

       });

   }
}

Eelco Hillenius wrote:
> On 8/7/07, Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk> wrote:
>   
>> Ok, I'll try to explain myself a little better.
>>
>> Im using the tabs from extensions, tabs require that what you work with
>> are panels (otherwise I would have done this with pages).
>>
>> So some of my tabs have a certain flow. Inorder to create that flow I
>> have to replace panels along the way, for example start with the search
>> panel, then replace the search panel with the edit panel.
>>
>> However wicket complains that you cant add the panel via ajax with being
>> attached to a page, and since im replaceing not adding this cant be done?
>>
>> Am I using a wrong approach on this?
>>     
>
> I'm not sure what goes wrong. I'm doing component replacements via
> Ajax all the time, without any wizardy needed. Can you give us a code
> fragment of what you were doing earlier?
>
> Eelco
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>   

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


Re: {wicket 1.3 Beta 2} Adding panel via ajax...

Posted by Eelco Hillenius <ee...@gmail.com>.
On 8/7/07, Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk> wrote:
> Ok, I'll try to explain myself a little better.
>
> Im using the tabs from extensions, tabs require that what you work with
> are panels (otherwise I would have done this with pages).
>
> So some of my tabs have a certain flow. Inorder to create that flow I
> have to replace panels along the way, for example start with the search
> panel, then replace the search panel with the edit panel.
>
> However wicket complains that you cant add the panel via ajax with being
> attached to a page, and since im replaceing not adding this cant be done?
>
> Am I using a wrong approach on this?

I'm not sure what goes wrong. I'm doing component replacements via
Ajax all the time, without any wizardy needed. Can you give us a code
fragment of what you were doing earlier?

Eelco

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


Re: {wicket 1.3 Beta 2} Adding panel via ajax...

Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Ok, I'll try to explain myself a little better.

Im using the tabs from extensions, tabs require that what you work with 
are panels (otherwise I would have done this with pages).

So some of my tabs have a certain flow. Inorder to create that flow I 
have to replace panels along the way, for example start with the search 
panel, then replace the search panel with the edit panel.

However wicket complains that you cant add the panel via ajax with being 
attached to a page, and since im replaceing not adding this cant be done?

Am I using a wrong approach on this?

regards Nino

Nino Saturnino Martinez Vazquez Wael wrote:
> Hi
>
> I have a panel I want to replace by another panel via ajax. However 
> when trying to replace the panel I get this message:
>
> WicketMessage: This component is not (yet) coupled to a page. It has 
> to be able to find the page it is supposed to operate in before you 
> can call this method (Component#getMarkupId)
>
> What should I do to avoid this?
>
> regards Nino
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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