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

client-bind.jar on the classpath loads client-bind.wpd and has side effect

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • 10.2.0
    • 10.0.0
    • None
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      run a ZK 10 project with client-bind jar on classpath.
      run attached sample

      Current Result

      client-bind.wpd is added to the page, causing matchmedia to triggers twice.
      (once for regular matchMedia, one when binder is created by client-bind)

      Expected Result

      just adding client-bind without zk.xml or apply="ClientBindComposer" shouldn't affect unrelated pages.

      Debug Information

      zul.tab.Tabbox.prototype.setSelectedTab calls this._getBinder()
      _getBinder creates a binder if none is found
      creating binder causes matchMedia to be sent

      additionally, under some circumstances, the binder initializes when the components are not attached to a deskop, which causes a null error at client-side.
      (ask matt)

      Workaround

      workaround for SPECIFICALLY the tabbox setSelectedTab issue (doesn't cover other possible side-effects of having client-bind in page)

      <script><![CDATA[ 
      		zk.afterLoad("zul.tab", function () {
      		    var _xTabbox = {};
      		    zk.override(zul.tab.Tabbox.prototype, _xTabbox, {
      		    	setSelectedTab: function (selectedTab, fromServer) {
      					if (this._selTab != selectedTab) {
      		    	        this._setSel(selectedTab, !fromServer);
      		    	        this._selTab = selectedTab;
      					}
      		   	      if (!fromServer) {
      		    	  	var binder = this._getBinder();
      		    	      if (binder) {
      	    	          this.fire('onSelect', {
      	    	            items: [selectedTab],
      	    	            reference: selectedTab
      	    	          }, {
      		   	            toServer: false
      	    	          }); // to trigger save binding
      	    	        }
      	    	      }
      	    	      return this;
      	    	    }
      		     });
      		});
      	]]></script>
      

        1. error.png
          error.png
          19 kB
        2. include-tab.zul
          0.3 kB
        3. InnerViewModel.java
          0.7 kB

            jumperchen jumperchen
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: