On Aug 13, 2013, at 6:52 PM, Thiago H de Paula Figueiredo 
<thiag...@gmail.com<mailto:thiag...@gmail.com>> wrote:

On Tue, 13 Aug 2013 18:32:46 -0300, Tony Nelson 
<tnel...@starpoint.com<mailto:tnel...@starpoint.com>>
wrote:

I have a simple page that has an ActivationContext.  I'd like to handle
a simple ajax call with one parameter.

When I use componentResource.createEventLink("foo"), the URL contains
the ActivationContext, like this:

/ih/view:foo?t:ac=77

I don't need the ActivationContext for this call, and I want to post the
ajax call, so this URL won't work.

Please define "this URL won't work". If you created it through
ComponentResources.createEventLink(), it will work. The activation context
of an event is separate from the activation context of the page
surrounding it.


The method that I expect to be called is:

    public void onDeleteContactLog(ContactLog contactLog) {
        logger.info(contactLog.getContactLogId().toString());
        if (isShowEdit()) {
            jacketLogic.deleteContactLog(contactLog);
        }
    }


I setup my JS the normal way:

    @Import(library = { "ViewJacket.js", "context:/js/tiny_mce/tiny_mce.js" })
    public void afterRender() {
        JSONObject specs = new JSONObject(
                "jacketId", jacket.getJacketId().toString(),
                "jacketName", jacket.getFullName(),
                "deleteContactLog", "/instihire/jacket/view:deletecontactlog/"
                // componentResources.createEventLink("deleteContactLog", new 
Object[] {}).toURI()
        );

        javaScriptSupport.addInitializerCall("viewJacket", specs);
    }

Pasted there is the working, hard coded URL for the event

The Javascript is simple click handler:

            $(".deleteContactLog").click(function (event) {
                event.stopPropagation();

                var url = _specs.deleteContactLog + $(this).data('id');
                var self = this;

                $.post(url,
                    function (data) {
                        $(self).closest("tr").hide();
                    })
                    .fail(function (data) {
                        window.alert('Deleting the contact log failed.');
                    });
            })

If I change the URL to the one created by component resources 
(/instihire/jacket/view:deletecontactlog?t:ac=98298828372) I get the following 
error:

[ERROR] TapestryModule.RequestExceptionHandler Processing of request failed 
with uncaught exception: Request event 'deletecontactlog' (on component 
jacket/View) was not handled; you must provide a matching event handler method 
in the component or in one of its containers.
org.apache.tapestry5.ioc.internal.util.TapestryException: Request event 
'deletecontactlog' (on component jacket/View) was not handled; you must provide 
a matching event handler method in the component or in one of its containers.
at 
org.apache.tapestry5.internal.services.AjaxComponentEventRequestHandler.handle(AjaxComponentEventRequestHandler.java:114)
at 
org.apache.tapestry5.internal.services.ajax.AjaxFormUpdateFilter.handle(AjaxFormUpdateFilter.java:56)


Thanks for your help.
Tony

________________________________
Since 1982, Starpoint Solutions has been a trusted source of human capital and 
solutions. We are committed to our clients, employees, environment, community 
and social concerns. We foster an inclusive culture based on trust, respect, 
honesty and solid performance. Learn more about Starpoint and our social 
responsibility at http://www.starpoint.com/social_responsibility

________________________________
This email message from Starpoint Solutions LLC is for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
Any unauthorized review, use, disclosure or distribution is prohibited. If you 
are not the intended recipient, please contact the sender by reply email and 
destroy all copies of the original message. Opinions, conclusions and other 
information in this message that do not relate to the official business of 
Starpoint Solutions shall be understood as neither given nor endorsed by it.

Reply via email to