0

Important Event not firing to server from widget

asked 2015-06-03 08:29:27 +0800

JustinFrost gravatar image JustinFrost
145 1 6

updated 2015-06-03 08:30:25 +0800

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.

delete flag offensive retag edit
Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2015-06-03 08:29:27 +0800

Seen: 10 times

Last updated: Jun 03 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More