Hi. Thanks for the awesome improvement. I want to adopt it immediately. But
I've stumbled to one problem. How do I pass a parameter to the event?

Here's the onEvent method that will be invoked

@OnEvent("updateNodes")
void updateNodes(@RequestParameter(value = "param", allowBlank = false)
String param) {
    logger.debug("On update nodes {} ", param);
}

In the old way i could call it using

$('#saveChanges').click(function () {
    var my_param = {'example param'};

    routejs.jsClickCallback(tSpec.updateOrderEventLink, tSpec.zoneId,
JSON.stringify(my_param));
});

var jsClickCallback = function(listenerURI, zoneElementId, param) {
  var listenerURIWithValue = listenerURI;

  listenerURIWithValue = appendQueryStringParameter(listenerURIWithValue,
'param', param);

  zoneManager.deferredZoneUpdate(zoneElementId, listenerURIWithValue);
};

var appendQueryStringParameter = function(url, name, value) {
  if (url.indexOf('?') < 0) {
    url += '?'
  }
  else {
    url += '&';
  }
  value = escape(value);
  url += name + '=' + value;
  return url;
}

On Sun, Apr 23, 2017 at 6:04 AM, Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

> Cool! It's nice to see a feature I've wanted for so long already being
> adopted by users. Thanks for the example!
>
> On Fri, Apr 21, 2017 at 11:18 AM, Svein-Erik Løken <sv...@jacilla.no>
> wrote:
>
> > The @PublishEvent was a big improvement 😊
> >
> >
> >
> > I am using it already. I have created a working demo. I really like that
> > it is so easy to stop hardcoding of event url.
> >
> >
> >
> >
> >
> > https://github.com/sveine/tapestry-multi-module-demo/
> > blob/master/module1-root/module1/src/main/java/com/demo/module1/pages/
> > PublishEventDemo.java
> >
> > https://github.com/sveine/tapestry-multi-module-demo/
> > blob/master/module1-root/module1/src/main/resources/
> > com/demo/module1/pages/PublishEventDemo.tml
> >
> > https://github.com/sveine/tapestry-multi-module-demo/
> > blob/master/module1-root/module1/src/main/resources/META-INF/modules/
> > publisheventdemo.js
> >
> > https://github.com/sveine/tapestry-multi-module-demo/
> > blob/master/core/src/main/resources/META-INF/modules/
> util/tapestryutil.js
> > (TapestryUtil.ajaxEvent)
> >
>
>
>
> --
> Thiago
>



-- 
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771

Reply via email to