groovyzk/grailszk

Registering events

asmbit opened this issue · 5 comments

In zk-grails there was a simple way to register events:

void init(Component comp) { comp.onClick { event -> ...//processing the event } }

Now this code produces an error:

org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: org.zkoss.zul.Image.addEventListener() is applicable for argument types: (String, com.sun.proxy.$Proxy117) values: ...

All similar shortcut for event listeners were affected. zk's EventListener import was missing. Version 3 of Groovy imports java.util by default, java.util.EventListener was being imported, not resulting in a Compilation error.

Fix will be released by the start of the next week.

This bug was fixed in version 3.2.1 and 4.2.1. @asmbit, can you confirm it is not working up from these releases? This bug affected other parts of the plugin which will be fixed in the next release as said previously.

Related to #11

I use grailszk version 3.2.2. I migrated code from zk-grails 2 with the following syntax:

comp.onClick = { event -> ... }

Now i realized when omitting the "=" everthing works fine. Would it be possible to keep optionally the "=" in grailszk?

Thanks a lot :)

Would it be possible to keep optionally the "=" in grailszk?

It's possible. I'll remind you when I implement this feature