[
https://issues.apache.org/jira/browse/TAP5-2225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15028612#comment-15028612
]
Thiago H. de Paula Figueiredo edited comment on TAP5-2225 at 11/26/15 11:52 AM:
--------------------------------------------------------------------------------
Hi!
What do you mean by module?
It would be actually easy to use. You'd just need to call something like
T5.triggerEvent(domElement, eventName, queryParameters, successHandler,
failureHandler). The domElement parameter is where the search for the data
attribute will start and then go recursively through its parents until it's
found. That function would take care of finding the correct event URL and
making the AJAX call. There would be probably a similar function for updating
zones.
The mixin would work server-side on a component, inspecting which events it
handles and storing in data attributes its names and URLs which would later be
used by the JavaScript functions. This way, it doesn't matter if it's a
component or page, it would never create an URL for a non-existing event and
avoids generating links for embedded components.
Creating event links for embedded components, IMHO, is something that should be
avoided.
Also IMHO, limiting this to pages which aren't in a subdirectory (which I don't
think the term "non-nested" applies, as it's not related to nesting at all, and
pages cannot be nested) is a serious limitation, as it excludes its use in
pages provided by component libraries.
was (Author: thiagohp):
Hi!
What do you mean by module?
I would be actually easy to use. You'd just need to call something like
T5.triggerEvent(domElement, eventName, queryParameters, successHandler,
failureHandler). That function would take care of finding the correct event URL
and making the AJAX call. There would be probably a similar function for
updating zones.
The mixin would work server-side on a component, inspecting which events it
handles and storing in data attributes its names and URLs which would later be
used by the JavaScript functions. This way, it doesn't matter if it's a
component or page, it would never create an URL for a non-existing event and
avoids generating links for embedded components.
Creating event links for embedded components, IMHO, is something that should be
avoided.
Also IMHO, limiting this to pages which aren't in a subdirectory (which I don't
think the term "non-nested" applies, as it's not related to nesting at all) is
a serious limitation, as it excludes its use in pages provided by component
libraries.
> Create client-side API to call a component's event handler methods
> ------------------------------------------------------------------
>
> Key: TAP5-2225
> URL: https://issues.apache.org/jira/browse/TAP5-2225
> Project: Tapestry 5
> Issue Type: Improvement
> Components: tapestry-core
> Affects Versions: 5.4
> Reporter: Jochen Kemnade
> Assignee: Thiago H. de Paula Figueiredo
> Labels: ajax, event, handler, javascript
>
> It should be possible to create URLs for components' event handlers on the
> client side.
> There could be a function that mirrors the behavior of
> ComponentResources#createEventLink. It might be passed an event name or an
> object with additional information such as a page name, a request context, or
> additional request parameters.
> The function could either return the URL or a function that makes an XHR and
> passes the response to a callback.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)