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

Grid columns onChildAdded removes the scrollbar faker column, cause desync with content

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 9.0.0
    • 8.5.1.2, 8.6.0.1
    • None
    • Security Level: Jimmy
    • None
    • None

      Steps to Reproduce

      Run fiddle:
      http://zkfiddle.org/sample/2im5kjg/2-Columns-and-Cells-not-in-sync-after-appending-column#source-1
      Click on Append column
      Click on show all

      Current Result

      When appending a column, the scrollbar faker is removed if the grid doesn't currently need to display a scrollbar (content height < grid height)
      However, when more items are added to the grid and a scrollbar is shown, the column faker is still not available, which cause the grid content to scroll further than the headers.

      Expected Result

      Adding a column should not remove the scrollbar faker div

      Debug Info

      https://github.com/zkoss/zk/blob/7b60924474ecaf28deb0855a6a5714b2e03df825/zul/src/archive/web/js/zul/mesh/HeadWidget.js#L196-L210

      Root Cause

      Workaround

      rerender the grid on adding a column:

      <script><![CDATA[
      		zk.afterLoad('zul.mesh', function() {
      			var xColumnMenuWidget = {};
      			zk.override(zul.mesh.ColumnMenuWidget.prototype, xColumnMenuWidget ,{
      				onChildAdded_ : function() {
      					var result = xColumnMenuWidget.onChildAdded_.apply(this, arguments);
      					this.rerender();
      					return result;
      				}
      			});//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 - 4 hours
                4h
                Remaining:
                Time Spent - 3 hours Remaining Estimate - 1 hour
                1h
                Logged:
                Time Spent - 3 hours Remaining Estimate - 1 hour
                3h