Revision history [back]

click to hide/show revision 1
initial version

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

kaduk gravatar image kaduk

Toggle Popup not closing

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

Toggle Popup not closing

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

Toggle Popup not closing

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
Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More