That's actually quite easy:

define(["jquery", "t5/core/utils", "t5/core/ajax", "t5/core/events"],
function($, utils, ajax, events) {
    return function(spec) {
        var $zoneElement = $('#' + spec.zoneElementId)
        $zoneElement.trigger(events.zone.refresh, { url: spec.zoneRefreshUrl })
    };
});

And you can construct and pass the actual zoneRefreshUrl using
ComponentResources.createEventLink method when using
JavaScriptSupport.require.
Event handler method, in this case, is supposed do something like
ajaxResponseRenderer.addRender(zoneElement), or simply return injected
block.


On Fri, Dec 14, 2018 at 3:04 AM Christopher Dodunski <
chrisfromtapes...@christopher.net.nz> wrote:

> Hi all,
>
> I had mistakenly thought that any event handler method could render a
> response through return type, whereas seemingly this is unique to events
> triggered by Tapestry's actionlink, eventlink and form components.
>
> I developed a filter pane component for limiting the number and (date)
> range of hibernate results displayed.  The idea was for this pane to
> trigger a "filter" event - componentResources.triggerEvent("filter", null,
> null) - causing the container to refresh the zone that contains the
> results.  But invoking onFilter() produces the error: "This type of event
> does not support return values from event handler methods."
>
> What is the usual method for triggering events so that a handler method
> renders a response based on return type (zone body in my case)?
>
> I guess my handler method could rather respond to the "success" event that
> bubbles up from the filter pane's internal form, as with beaneditform, but
> this isn't an ideal or elegant approach in all situations.
>
> Regards,
>
> Chris.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

-- 
Ilya Obshadko

Reply via email to