Re: refresh page from an AjaxLink or OnChangeAjaxBehavior

2012-05-10 Thread jensiator
Do you really need to call this?
setResponse(currentPage.getClass(), currentPage.getPageParameters()); 

If its just some components on the same page that will be affected by the
dropdown change, the above solution feels unnecessary. If you use ajax or
javascript the page don't need to be updated in a ordinary. request 

You could just update the component/components on the page that my be
affected by the dropdown change. You can do this by adding these components
to the AjaxRequestTarget.
If you add a AjaxFormComponentUpdatingBehavior on the dropdown, and a model
to the page, you would even update the model with the dropdown value. Any
components that you have added to the AjaxRequestTarget would then render.
In these affected components you can either override onComponentTag or
--TagBody to change it rendered values. I prefer to give the components a
specialized model. 
in wicket 1.5 you can do it even decoupled. 

If I not completely off target I can give you some code examples..



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/refresh-page-from-an-AjaxLink-or-OnChangeAjaxBehavior-tp4614698p4623193.html
Sent from the Users forum mailing list archive at Nabble.com.

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



refresh page from an AjaxLink or OnChangeAjaxBehavior

2012-05-07 Thread Mihai Toma
Hi,

 

I have an OnChangeAjaxBehavior on a DropDownChoice component.

 

After I change a value in that drop down I want to reload the page using
setResponse(currentPage.getClass(), currentPage.getPageParameters());

 

themeComp.add(new OnChangeAjaxBehavior() {

private static final long
serialVersionUID = -1973825163343103968L;

 

@Override

protected void
onUpdate(final AjaxRequestTarget arg0) {

 
setAValueInSession();

setResponse(currentPage.getClass(), currentPage.getPageParameters());

}

});

 

The response from ajax debug is ERROR: Wicket.Ajax.Call.failure: Error
while parsing response: Could not find root ajax-response element. I
receive the content from ajax but it is not between ajax-response element.

 

I verify this problem on AjaxLink and the response is the same as from
OnChangeAjaxBehavior.

 

Do you have any idea how to reload the page from an AjaxLink or
OnChangeAjaxBehavior ?

 

Thanks,

Mihai



RE: refresh page from an AjaxLink or OnChangeAjaxBehavior

2012-05-07 Thread Mihai Toma
Forgot to say wicket 1.5.5.

Mihai

-Original Message-
From: Mihai Toma [mailto:mihai.t...@asf.ro] 
Sent: Monday, May 07, 2012 3:47 PM
To: users@wicket.apache.org
Subject: refresh page from an AjaxLink or OnChangeAjaxBehavior

Hi,

 

I have an OnChangeAjaxBehavior on a DropDownChoice component.

 

After I change a value in that drop down I want to reload the page using
setResponse(currentPage.getClass(), currentPage.getPageParameters());

 

themeComp.add(new OnChangeAjaxBehavior() {

private static final long
serialVersionUID = -1973825163343103968L;

 

@Override

protected void
onUpdate(final AjaxRequestTarget arg0) {

 
setAValueInSession();

setResponse(currentPage.getClass(), currentPage.getPageParameters());

}

});

 

The response from ajax debug is ERROR: Wicket.Ajax.Call.failure: Error
while parsing response: Could not find root ajax-response element. I
receive the content from ajax but it is not between ajax-response element.

 

I verify this problem on AjaxLink and the response is the same as from
OnChangeAjaxBehavior.

 

Do you have any idea how to reload the page from an AjaxLink or
OnChangeAjaxBehavior ?

 

Thanks,

Mihai



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



Re: refresh page from an AjaxLink or OnChangeAjaxBehavior

2012-05-07 Thread Martin Grigorov
This should just work.
Not sure why it breaks for you.
Create a quickstart app and attach it to a ticket.

On Mon, May 7, 2012 at 3:53 PM, Mihai Toma mihai.t...@asf.ro wrote:
 Forgot to say wicket 1.5.5.

 Mihai

 -Original Message-
 From: Mihai Toma [mailto:mihai.t...@asf.ro]
 Sent: Monday, May 07, 2012 3:47 PM
 To: users@wicket.apache.org
 Subject: refresh page from an AjaxLink or OnChangeAjaxBehavior

 Hi,



 I have an OnChangeAjaxBehavior on a DropDownChoice component.



 After I change a value in that drop down I want to reload the page using
 setResponse(currentPage.getClass(), currentPage.getPageParameters());



 themeComp.add(new OnChangeAjaxBehavior() {

                                                private static final long
 serialVersionUID = -1973825163343103968L;



                                                @Override

                                                protected void
 onUpdate(final AjaxRequestTarget arg0) {


 setAValueInSession();

 setResponse(currentPage.getClass(), currentPage.getPageParameters());

                                                }

                                });



 The response from ajax debug is ERROR: Wicket.Ajax.Call.failure: Error
 while parsing response: Could not find root ajax-response element. I
 receive the content from ajax but it is not between ajax-response element.



 I verify this problem on AjaxLink and the response is the same as from
 OnChangeAjaxBehavior.



 Do you have any idea how to reload the page from an AjaxLink or
 OnChangeAjaxBehavior ?



 Thanks,

 Mihai



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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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