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

Tree _initPadSizes while not visible cause tree height to shink to 2 treeitems

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.6.1
    • 8.6.0.1
    • None
    • Security Level: Jimmy
    • None
    • ZK 8.6.1 S1

      Steps to Reproduce

      run fiddle
      http://zkfiddle.org/sample/1ho88ob/1-hidden-tab-tree-initpadsizes

      Go to the "tree" tab
      click the add button 3 times to add some tree items
      Go to the the "buttons" tab
      Click on the add button 3 times to add some tree items
      Go to the "Tree" tab again

      Current Result

      tree is shrunk to 2 treeitems
      additional clicks on the add button will cause the tree to resize, then will cause the tree to add missing items

      Expected Result

      tree initPadSize calculation should not fail offscreen

      Debug Info

      When the dom node is hidden, calculation fails due to missing height information.
      Will affect any case where a tree is updated while hidden.

      Root Cause

      in the _initPadSizes function, b.offsetHeight == 0 if the dom node is hidden

      Workaround

      			<script><![CDATA[  
      				zk.afterLoad('zul.sel', function() {
      					var xTree = {};
      					zk.override(zul.sel.Tree.prototype, xTree ,{
      						onShow : function() {
      							this._initPadSizes();
      						},
      						bind_: function(){
      							var result = xTree.bind_.apply(this, arguments);
      							zWatch.listen({onShow: this});
      						},
      						unbind_: function(){
      							zWatch.unlisten({onShow: this});
      							var result = xTree.unbind_.apply(this, arguments);
      						}
      					});//zk.override
      				});//zk.afterLoad
      			]]></script>
      

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

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Time Spent - 6 hours, 30 minutes Remaining Estimate - 1 hour, 30 minutes
                1h 30m
                Logged:
                Time Spent - 6 hours, 30 minutes Remaining Estimate - 1 hour, 30 minutes
                6h 30m