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

calculation issue in tpad cause grid to render entire content at once

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 10.0.0, 9.6.3
    • 9.6.2
    • None
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      https://zkfiddle.org/sample/2ciuc58/3-grid-extra-rendering

      Run locally (not fiddle), using chrome debugger tools with sensors > touch (force enabled)

      to emulate an hybrid device like a touchscreen laptop (touch + mouse)

      With zkmax

      make sure that zk.touchEnabled is "true" after loading

      Click button

      Current Result

      grid loads initial items, then send onRender for all items in the grid

      Expected Result

      grids load items when user scrolls

      Debug Information

      caused by zul.mesh.Scrollbar.getScrollPosV from the grid-touch zkmax override.

      The grid may have wgt_padsz == {}

      as set by grid-rod.js $init override

      This cause getScrollPosV to return NaN.

      This causes grid#_onRender to have min and max == NaN

       

      min = zul.mesh.Scrollbar.getScrollPosV(this),
       max = min + this.ebody.offsetHeight;

       

      because of this, the following conditions are never met:

      if (top + $row.offsetHeight() < min) continue;
       if (top > max) break; //Bug 1822517

      which causes all of the grid rows to be processed and added to the items to render

       

      Workaround

      <script><![CDATA[ 
      		zk.afterLoad("zul.mesh, zkmax", function () {
      			zul.mesh.Scrollbar.getScrollPosV = function (wgt) {
      				var ebody = wgt.ebody,
      					ebodytbl = wgt.ebodytbl,
      					scrollTop = jq(ebody).offset().top - jq(ebodytbl).offset().top;
      				
      				return (wgt._padsz && wgt._padsz['tpad']) ? scrollTop + wgt._padsz['tpad'] : scrollTop;
      			};
      		});
      	]]></script>
      

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

              Created:
              Updated:
              Resolved: