You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Frank Klein Koerkamp <fk...@educator.eu> on 2009/04/09 15:38:01 UTC

How to manipulate an AjaxRequest

Hi all,

i have an Ajax call and when an exception occurs, i want to display the exception in an ModalWindow.
But i also want to be able to delete everything(component, javascript) that is added or will be added to the AjaxRequestTarget.
So only modalwindow popup but state on page stays the same.

At this moment i'm able to let the window popup, but not yet to delete the other content that has been added to the AjaxRequestTarget.

Does anyone have any suggestions?

Kind regards,

Frank Klein Koerkamp


________________________________
The information contained in this communication is confidential, intended solely for the use of the individual or entity to whom it is addressed and may be legally privileged and protected by professional secrecy. Access to this message by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it is prohibited and may be unlawful. Please immediately contact the sender if you have received this message in error. This email does not constitute any commitment from Cordys Holding BV or any of its subsidiaries except when expressly agreed in a written agreement between the intended recipient and Cordys Holding BV or its subsidiaries. Cordys is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt. Cordys does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference. If you are not the intended recipient of this communication please return the communication to the sender and delete and destroy all copies.

RE: How to manipulate an AjaxRequest

Posted by Frank Klein Koerkamp <fk...@educator.eu>.
Hi Martin,

we have an solution, thanks for your help. Sort like your proposal. But an command that has to be executed.
This command will force to do the data manipulation before any markup changes. So markup changes won't be done if data manipulation gives exception. See example under:

public void execute(AjaxRequestTarget target) {
        try{
                executeAction(target); --> Do data manipulation here
                onActionSuccess(target);
        } catch(Exception e) {
            onActionFailure(target);
        }
}

Regards,

Frank

-----Original Message-----
From: Martin Makundi [mailto:martin.makundi@koodaripalvelut.com]
Sent: Thursday, April 09, 2009 4:48 PM
To: users@wicket.apache.org
Subject: Re: How to manipulate an AjaxRequest

> It could work, but that's not what I want, because also after the exception is thrown components could be added to the target.
> In that case I've to check on every add to target if an exception has occurred. I prefer to do this on one place.

Maybe your exception handling could deal with this?

Would you like to show your code in order for us to have a closer view
on your particular situation?

**
Martin

>
>
> -----Original Message-----

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


The information contained in this communication is confidential, intended solely for the use of the individual or entity to whom it is addressed and may be legally privileged and protected by professional secrecy. Access to this message by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it is prohibited and may be unlawful. Please immediately contact the sender if you have received this message in error. This email does not constitute any commitment from Cordys Holding BV or any of its subsidiaries except when expressly agreed in a written agreement between the intended recipient and Cordys Holding BV or its subsidiaries. Cordys is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt. Cordys does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference. If you are not the intended recipient of this communication please return the communication to the sender and delete and destroy all copies.

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


Re: How to manipulate an AjaxRequest

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
> It could work, but that's not what I want, because also after the exception is thrown components could be added to the target.
> In that case I've to check on every add to target if an exception has occurred. I prefer to do this on one place.

Maybe your exception handling could deal with this?

Would you like to show your code in order for us to have a closer view
on your particular situation?

**
Martin

>
>
> -----Original Message-----

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


RE: How to manipulate an AjaxRequest

Posted by Frank Klein Koerkamp <fk...@educator.eu>.
It could work, but that's not what I want, because also after the exception is thrown components could be added to the target.
In that case I've to check on every add to target if an exception has occurred. I prefer to do this on one place.
But thanks for your suggestion.

Regards,

Frank


-----Original Message-----
From: Martin Makundi [mailto:martin.makundi@koodaripalvelut.com]
Sent: Thursday, April 09, 2009 4:34 PM
To: users@wicket.apache.org
Subject: Re: How to manipulate an AjaxRequest

>From what I can see you could have:

List<Component> refreshThese = new LinkedList<Component>();

you add your components to refreshThese.add(component); and if your db
update fails, just call refreshThese.clear()? Otherwise iterate
through all refreshThese components and
target.addComponent(refreshThese.get(itemIndex));

Could it work? Why not?

**
Martin

2009/4/9 Frank Klein Koerkamp <fk...@educator.eu>:
> The exception may  occur when I try to delete a record in a table.
> So I click on the delete link this triggers an event that will delete record from db.
> After deletion I've to refresh an component on page, but if db gives error i don't want to do refresh anything.
>
> Regards,
>
> Frank
>
> -----Original Message-----
> From: Martin Makundi [mailto:martin.makundi@koodaripalvelut.com]
> Sent: Thursday, April 09, 2009 3:45 PM
> To: users@wicket.apache.org
> Subject: Re: How to manipulate an AjaxRequest
>
> You could collect your components into a list or collection before
> adding them into the Target..? Or does the error occur at render-time?
>
> **
> Martin
>
> 2009/4/9 Frank Klein Koerkamp <fk...@educator.eu>:
>> Hi all,
>>
>> i have an Ajax call and when an exception occurs, i want to display the exception in an ModalWindow.
>> But i also want to be able to delete everything(component, javascript) that is added or will be added to the AjaxRequestTarget.
>> So only modalwindow popup but state on page stays the same.
>>
>> At this moment i'm able to let the window popup, but not yet to delete the other content that has been added to the AjaxRequestTarget.
>>
>> Does anyone have any suggestions?
>>
>> Kind regards,
>>
>> Frank Klein Koerkamp
>>
>>
>> ________________________________
>> The information contained in this communication is confidential, intended solely for the use of the individual or entity to whom it is addressed and may be legally privileged and protected by professional secrecy. Access to this message by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it is prohibited and may be unlawful. Please immediately contact the sender if you have received this message in error. This email does not constitute any commitment from Cordys Holding BV or any of its subsidiaries except when expressly agreed in a written agreement between the intended recipient and Cordys Holding BV or its subsidiaries. Cordys is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt. Cordys does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference. If you are not the intended recipient of this communication please return the communication to the sender and delete and destroy all copies.
>>
>
> ---------------------------------------------------------------------
> 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: How to manipulate an AjaxRequest

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
>From what I can see you could have:

List<Component> refreshThese = new LinkedList<Component>();

you add your components to refreshThese.add(component); and if your db
update fails, just call refreshThese.clear()? Otherwise iterate
through all refreshThese components and
target.addComponent(refreshThese.get(itemIndex));

Could it work? Why not?

**
Martin

2009/4/9 Frank Klein Koerkamp <fk...@educator.eu>:
> The exception may  occur when I try to delete a record in a table.
> So I click on the delete link this triggers an event that will delete record from db.
> After deletion I've to refresh an component on page, but if db gives error i don't want to do refresh anything.
>
> Regards,
>
> Frank
>
> -----Original Message-----
> From: Martin Makundi [mailto:martin.makundi@koodaripalvelut.com]
> Sent: Thursday, April 09, 2009 3:45 PM
> To: users@wicket.apache.org
> Subject: Re: How to manipulate an AjaxRequest
>
> You could collect your components into a list or collection before
> adding them into the Target..? Or does the error occur at render-time?
>
> **
> Martin
>
> 2009/4/9 Frank Klein Koerkamp <fk...@educator.eu>:
>> Hi all,
>>
>> i have an Ajax call and when an exception occurs, i want to display the exception in an ModalWindow.
>> But i also want to be able to delete everything(component, javascript) that is added or will be added to the AjaxRequestTarget.
>> So only modalwindow popup but state on page stays the same.
>>
>> At this moment i'm able to let the window popup, but not yet to delete the other content that has been added to the AjaxRequestTarget.
>>
>> Does anyone have any suggestions?
>>
>> Kind regards,
>>
>> Frank Klein Koerkamp
>>
>>
>> ________________________________
>> The information contained in this communication is confidential, intended solely for the use of the individual or entity to whom it is addressed and may be legally privileged and protected by professional secrecy. Access to this message by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it is prohibited and may be unlawful. Please immediately contact the sender if you have received this message in error. This email does not constitute any commitment from Cordys Holding BV or any of its subsidiaries except when expressly agreed in a written agreement between the intended recipient and Cordys Holding BV or its subsidiaries. Cordys is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt. Cordys does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference. If you are not the intended recipient of this communication please return the communication to the sender and delete and destroy all copies.
>>
>
> ---------------------------------------------------------------------
> 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: How to manipulate an AjaxRequest

Posted by Frank Klein Koerkamp <fk...@educator.eu>.
The exception may  occur when I try to delete a record in a table.
So I click on the delete link this triggers an event that will delete record from db.
After deletion I've to refresh an component on page, but if db gives error i don't want to do refresh anything.

Regards,

Frank

-----Original Message-----
From: Martin Makundi [mailto:martin.makundi@koodaripalvelut.com]
Sent: Thursday, April 09, 2009 3:45 PM
To: users@wicket.apache.org
Subject: Re: How to manipulate an AjaxRequest

You could collect your components into a list or collection before
adding them into the Target..? Or does the error occur at render-time?

**
Martin

2009/4/9 Frank Klein Koerkamp <fk...@educator.eu>:
> Hi all,
>
> i have an Ajax call and when an exception occurs, i want to display the exception in an ModalWindow.
> But i also want to be able to delete everything(component, javascript) that is added or will be added to the AjaxRequestTarget.
> So only modalwindow popup but state on page stays the same.
>
> At this moment i'm able to let the window popup, but not yet to delete the other content that has been added to the AjaxRequestTarget.
>
> Does anyone have any suggestions?
>
> Kind regards,
>
> Frank Klein Koerkamp
>
>
> ________________________________
> The information contained in this communication is confidential, intended solely for the use of the individual or entity to whom it is addressed and may be legally privileged and protected by professional secrecy. Access to this message by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it is prohibited and may be unlawful. Please immediately contact the sender if you have received this message in error. This email does not constitute any commitment from Cordys Holding BV or any of its subsidiaries except when expressly agreed in a written agreement between the intended recipient and Cordys Holding BV or its subsidiaries. Cordys is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt. Cordys does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference. If you are not the intended recipient of this communication please return the communication to the sender and delete and destroy all copies.
>

---------------------------------------------------------------------
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: How to manipulate an AjaxRequest

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
You could collect your components into a list or collection before
adding them into the Target..? Or does the error occur at render-time?

**
Martin

2009/4/9 Frank Klein Koerkamp <fk...@educator.eu>:
> Hi all,
>
> i have an Ajax call and when an exception occurs, i want to display the exception in an ModalWindow.
> But i also want to be able to delete everything(component, javascript) that is added or will be added to the AjaxRequestTarget.
> So only modalwindow popup but state on page stays the same.
>
> At this moment i'm able to let the window popup, but not yet to delete the other content that has been added to the AjaxRequestTarget.
>
> Does anyone have any suggestions?
>
> Kind regards,
>
> Frank Klein Koerkamp
>
>
> ________________________________
> The information contained in this communication is confidential, intended solely for the use of the individual or entity to whom it is addressed and may be legally privileged and protected by professional secrecy. Access to this message by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it is prohibited and may be unlawful. Please immediately contact the sender if you have received this message in error. This email does not constitute any commitment from Cordys Holding BV or any of its subsidiaries except when expressly agreed in a written agreement between the intended recipient and Cordys Holding BV or its subsidiaries. Cordys is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt. Cordys does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference. If you are not the intended recipient of this communication please return the communication to the sender and delete and destroy all copies.
>

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