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

Client-side event listeners as standalone attributes

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Normal
    • Resolution: Invalid
    • Affects Version/s: 5.0.9
    • Fix Version/s: None
    • Component/s: Components
    • Labels:
    • Environment:

      Any

      Description

      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>

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: