0

Toggle Popup not closing

asked 2020-07-23 18:21:22 +0800

kaduk gravatar image kaduk
1 2

updated 2020-07-23 18:24:14 +0800

I'm using zk8.5.0. I have a Toggle Popup bound with a button and I want to handle onOpen events of my Popup. But when I start to listen to onOpen events then toggle mode stops working and Popup don't closing on second click to the button.

Simple example of zul and viewModel:

example.zul

<zk>
  <window viewModel="@id('vm') @init('pkg$.MyViewModel')">
    <button label="Button" popup="examplePopup, type=toggle"/>
    <popup id="examplePopup" onOpen="@command('handleOpenEvent')">
      <label value="example popup"/>
    </popup>
  </window>
</zk>

MyViewModel.java

public class MyViewModel {
  @Command
  public void handleOpenEvent(@ContextParam(ContextType.TRIGGER_EVENT) OpenEvent event) {
    //some event handling
  }
}

You can see how it works on zkfiddle: zkfiddle.org/sample/34ft7km/1-Toggle-Popup-not-closing


Actually, the question:

How can I handle OpenEvent of the Popup without changing proper Toggle Popup behavior?



Аdditional information:

During debugging I've found following behavior:

  1. Click to the button - Popup is opened, OpenEvent(isOpen=true) is generated
  2. Press the button again (but don't release) - Popup is closed, OpenEvent(isOpen=false) is generated
  3. Release the button - Popup is opened again, OpenEvent(isOpen=true) is generated
delete flag offensive retag edit

1 Answer

Sort by » oldest newest most voted
0

answered 2020-07-24 11:51:13 +0800

cor3000 gravatar image cor3000
5262 2 7
ZK Team

updated 2020-07-24 11:53:41 +0800

It doesn't look like you're doing anything wrong, so I assume it's a bug and posted ZK-4628

here an idea for a workaround ...

https://zkfiddle.org/sample/34ft7km/3-Toggle-Popup-not-closing-workaround-idea

not fully working though. since you can click anywhere else on the page to close the popup as well the close handling needs to be fine tuned a bit more.

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
2 followers

RSS

Stats

Asked: 2020-07-23 18:21:22 +0800

Seen: 5 times

Last updated: Jul 24

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