-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have create a new toggle component which has an onToggle event defined in its java class:
static {
addClientEvent(Toggle.class, "onToggle", CE_IMPORTANT|CE_REPEAT_IGNORE);
}
the service method handles the event:
public void service(org.zkoss.zk.au.AuRequest request, boolean everError) {
final String cmd = request.getCommand();
if (cmd.equals("onToggle")) {
Event evt = Event.getEvent(request);
final Map<String, Object> data = request.getData();
...
Events.postEvent(evt);
}
else
super.service(request, everError);
}
}
In my widget javascript I fire the event using this code:
this.fire('onToggle', {value: this.getState()});
The problem is the event never gets to the server as an AuRequest.
If I use the to server option:
zAu.send(new zk.Event(zk.Widget.$(this), 'onToggle',{value: this.getState()}, {toServer:true}));
it works fine, but if I do it this way I cannot capture the event on the client using the client namespace.
Am I missing something - the doco indicates that the event should go through to the server.
Asked: 2015-06-03 08:29:27 +0800
Seen: 10 times
Last updated: Jun 03 '15