Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-593

Client-side event listeners as standalone attributes

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Invalid
    • Icon: Normal Normal
    • None
    • 5.0.9
    • Components
    • Any

    • None

      I would like to be able to define client side listeners like this:

      <button label="Print" xmlns:w="client">
      <attribute name="w:onClick">window.open('real_download.jsp','Printing...');"</attribute>
      </button>

      So far it's not possible, for the ui engine yields the following exception

      org.zkoss.zk.ui.metainfo.PropertyNotFoundException: Method setW:onClick not found for class org.zkoss.zul.Button
      at org.zkoss.zk.ui.metainfo.Property.resolve(Property.java:190)
      at org.zkoss.zk.ui.metainfo.Property.assign0(Property.java:206)
      at org.zkoss.zk.ui.metainfo.Property.assign(Property.java:173)
      at org.zkoss.zk.ui.metainfo.ComponentInfo.applyProperties(ComponentInfo.java:829)
      at org.zkoss.zk.ui.impl.AbstractUiFactory.newComponent(AbstractUiFactory.java:96)
      at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:740)

      By having client-side event listeners as standalone attribute we could define them conditionally the way we do with component tags:

      <button label="Print" xmlns:w="client">
      <attribute if="${execution.explorer}" name="w:onClick">window.open('real_download.jsp','Printing...');"</attribute>
      </button>

            Unassigned Unassigned
            cvarona cvarona
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: