0

ZK Events Called Twice

asked 2017-06-15 19:53:46 +0800

Ildelian gravatar image Ildelian
5 2

We have a Java application with ZK 5.0. Actually, we are doing a Migration to ZK 8.

We have a problem with the events, some times, they are called Twice.

For example, in this line we send an Event to the Controller from JavaScript:

zAu.send(new zk.Event(zk.Widget.$(this), 'onMakePackageOnWebDav', JSON.stringify(data)));

And, in the Controller the method onMakePackageOnWebDav is executed, and when is finished, is ejecuted again.

It's happen in other objects, for example, the ComboBox in the zul files.

<combobox cols="7" id="combStates"  readonly="true" tabindex="4" selectedItem="window$composer.state"/>

When a item is selected from this Comboox, the setter for the variable is called twice, one with the value selected in the Combo and again with a null value.

Someone knows why this problem can occur?

delete flag offensive retag edit

4 Answers

Sort by ยป oldest newest most voted
0

answered 2017-06-19 08:06:27 +0800

Darksu gravatar image Darksu
1991 1 4

Hello,

You should check what events are sent, and also if multiple events are associated with the controller.

Also please find below a working example:

http://zkfiddle.org/sample/3u18u31/7-Use-zAu-send-to-send-data-to-server-from-client#source-1

Best,

Darksu

link publish delete flag offensive edit
0

answered 2017-06-19 12:40:07 +0800

Ildelian gravatar image Ildelian
5 2

No, only one event is asociated with the controller. the problem is in the version 8 after migrate from the Zk 5. In the version 5, we doesn't have this problem.

link publish delete flag offensive edit
0

answered 2017-06-19 18:25:51 +0800

Ildelian gravatar image Ildelian
5 2

updated 2017-06-19 18:26:39 +0800

Another example.

    <cell>
<hlayout sclass="z-valign-midlle">                                                              
<button id="previsualizarButton" iconSclass="z-icon-search" />
</hlayout>
</cell>

When do click in the button, this method is called twice:

public void onClick$previsualizarButton() {
    ----CODE CODE CODE ETC...----
}
link publish delete flag offensive edit
0

answered 2017-06-17 09:33:32 +0800

longdv1208 gravatar image longdv1208
98 4

We have a problem with the events, some times, they are called Twice. For example, in this line we send an Event to the Controller from JavaScript:

  zAu.send(new zk.Event(zk.Widget.$('$windowDashboard'), 'onShowVuongmac', {'madonvi' : 'ALL','type' : 'ALL'}, {toServer:true}));

@Listen("onShowVuongmac=#windowDashboard")
public void onShowVuongmac(Event evt) {
    JSONObject jsonObject = (JSONObject) evt.getData();
    String donvi = jsonObject.get("madonvi").toString();
}
link publish delete flag offensive edit
Your answer
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: 2017-06-15 19:53:46 +0800

Seen: 26 times

Last updated: Jun 19 '17

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