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

column resizing ghost doesn't check for scroll when calculating snap position

XMLWordPrintable

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

      Steps to Reproduce

      1. run the code

          <grid width="800px" height="200px">
              <columns sizable="true">
                  <column label="1" width="300px"/>
                  <column label="2" width="300px"/>
                  <column label="3" width="300px"/>
                  <column label="4" width="300px"/>
                  <column label="5" width="300px"/>
                  <column label="6" width="300px"/>
              </columns>
              <rows>
                  <row>
                      <label value="Item 1.1" />
                      <label value="Item 1.2" />
                      <label value="Item 1.3" />
                      <label value="Item 1.4" />
                      <label value="Item 1.5" />
                      <label value="Item 1.6" />
                  </row>
              </rows>
          </grid>
      

      2. scroll the grid to the right (grid must be scrolled)
      3. shrink the width the 5th column by draging its right border

      Current Result

      you can drag the right border over its left border.
      Amount of extra draggable space = grid scroll position
      See the attached video.

      Expected Result

      the dragging ghost line can't be over than the left border.
      Just like you drag the 1st column's right border.

      Debugging information

      During zul.mesh.HeaderWidget._snapsizing
      The snap position calculated with the following block calculates the position based on screen scroll only

      if (ofs[0] + dg._zmin >= pointer[0])
      			pointer[0] = ofs[0] + dg._zmin;
      

      Workaround

      for ZK 8.5.1.2
      Need to test for side effects
      Add grid scroll and document scroll check

      	<script><![CDATA[
      	zk.afterLoad('zul.grid', function() {
      		var xColumn = {};
      		zk.override(zul.grid.Column, xColumn ,{
      			_snapsizing: function (dg, pointer) {
      				var n = dg.control.$n(), $n = zk(n),
      					ofs = $n.revisedOffset(), innerScrollOffset = $n.scrollOffset()[0],
      					windowScroll = jq(window).scrollLeft();
      				pointer[0] += $n.offsetWidth();
      				if (ofs[0] + dg._zmin + innerScrollOffset - windowScroll >= pointer[0])
      					pointer[0] = ofs[0] + dg._zmin + innerScrollOffset - windowScroll;
      				return pointer;
      			}
      		});//zk.override
      	});//zk.afterLoad
      	]]></script>
      

            rudyhuang rudyhuang
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 4 hours
                4h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours
                4h