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

componentScope.get() causes error in zul file

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 5.0.9
    • 5.0.8
    • ZHTML
    • Windows 7, FireFox 5.0

      I am currently migrating our system from zk 3.6.4 to 5.0.8 and ran into a problem using the implicit componentScope object in a zul file. The following snippet of code illustrates the problem.

       
      <toolbar >
      	<toolbarbutton label="click me" onClick="alert(componentScope.get("key"))" >
      		<custom-attributes key="SomeValue"/>
      	</toolbarbutton>
      </toolbar>
      

      Running the code produces the following error:

       
      Sourced file: inline evaluation of: `` alert(componentScope.get("key"));'' : Error in method invocation: Method get( java.lang.String ) not found in class'org.zkoss.zk.ui.ext.Scopes$DeferredScope' : at Line: 2 : in file: inline evaluation of: `` alert(componentScope.get("key"));'' : componentScope .get ( "key" )
      

      The work around to the problem is to use self.getAttribute() instead of componentScope.get().

      This code worked great under zk 3.6.4.

            SimonPai SimonPai
            Jackster Jackster
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: