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

Grid onResponse cause incorrect flex min if not visible with touch events

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Normal Normal
    • 9.6.3
    • 9.6.1
    • None
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      Run fiddle as a standalone page.

      https://zkfiddle.org/sample/384b0g4/2-Another-new-ZK-fiddle

      Open developer tools, set userAgent to Ipad to mimic a touch and mouse device such as laptop with touch screen.

       

       

      Press the button "do a thing" to trigger a zkau request

      Press the button "show groupbox" to show the grid

      Current Result

      hflex="min" is calculated incorectly

      Expected Result

      hflex="min" is calculated correctly

      Debug Information

      onResponse listener triggers with the above conditions.

      During onResponse, grid#doResizeScroll is invoked, calculating the hflex="min" sizes for grid columns.

      If this happens onResponse while the grid is not visible, the size are calculated based on the non-rendered grid content.

      When the grid is made visible, it doesn't re-calculate min flex.

      Workaround

      Prevent grid to trigger doResizeScroll if not visible

      <script><![CDATA[ 
      	zk.afterLoad("zul.grid", function () {
      	    var _xGrid = {};
      	    zk.override(zul.grid.Grid.prototype, _xGrid, {
      	        doResizeScroll_: function() {
      				if(!this.isRealVisible())
      					return;
      	        	var result = _xGrid.doResizeScroll_.apply(this, arguments);
      				return result;
      	        }
      	     });
      	});
      ]]></script>
      

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

              Created:
              Updated:
              Resolved: