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

Following zk-3722, hidden cell / row style is incorrect

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 8.5.0
    • Fix Version/s: 8.5.0
    • Component/s: None
    • Security Level: Jimmy
    • Labels:
      None

      Description

      Steps to Reproduce

      Run snippet on current FL 8.5.0.FL.20170919

      <zk>
      <div apply="org.zkoss.bind.BindComposer">
      		<grid span="true" sizedByContent="true" width="500px"
      			height="200px" model="@init(([1, 2, 3, 4, 5].stream().toList()))">
      			<columns>
      				<column label="test" />
      				<column label="test" visible="false" align="right" />
      				<column label="test" align="right" />
      			</columns>
      			<template name="model">
      				<row>
      					<cell>
      						<label value="@load(each)" />
      					</cell>
      					<cell>
      						<label value="@load(each)" />
      					</cell>
      					<cell>
      						<label value="@load(each)" />
      					</cell>
      				</row>
      			</template>
      			<foot>
      				<footer label="test"></footer>
      				<footer label="test"></footer>
      				<footer label="test"></footer>
      			</foot>
      		</grid>
      	</div>
      </zk>
      

      Actual Result

      Columns and cells are not displayed correctly.
      Hidden cells with align right have a style of:
      style="width: 0.1pxtext-align:right;"
      instead of style="width: 0.1px;text-align:right;"
      which cause them to misinterpret the style

      Expected Result

      Cells / columns should have a valid style hiding the hidden cells.

      Debug Info

      tested with following to add the missing semicolon.
      However, this cause a different issue as the hidden cells don't shrink to 0.1px altogether

      zk.afterLoad('zul.grid', function() {
      		var xRow = {};
      		zk.override(zul.grid.Row.prototype, xRow ,{
      			_childAttrs: function(a, b) {
      	            var c = b
      	              , e = 1;
      	            if (this._spans)
      	                for (var d = 0, h = this._spans.length; d < h; ++d) {
      	                    if (d == b) {
      	                        e = this._spans[d];
      	                        break
      	                    }
      	                    c += this._spans[d] - 1
      	                }
      	            if ((b = this.getGrid()) && (d = b.columns) && c < d.nChildren) {
      	                var f = d.getChildAt(c);
      	                var g = b._model && this._loaded ? "width: 0.1px;" : "";
      	                var k = f.getHeight();
      	                var l = f.getAlign();
      	                f = f.getValign()
      	            }
      	            c = this.domStyle_({
      	                visible: 1,
      	                width: 1,
      	                height: 1
      	            });
      	            (b = zk.isLoaded("zkex.grid") && a.$instanceof(zkex.grid.Detail)) && (d = a.getWidth()) && (c += "width:" + d + ";");
      	            if (g || k || l || f)
      	                c += g,
      	                k && (c += "height:" + k + ";"),
      	                l && (c += "text-align:" + l + ";"),
      	                f && (c += "vertical-align:" + f + ";");
      	            a = b ? a.$s("outer") : this.$s("inner");
      	            g = "";
      	            1 !== e && (g += ' colspan="' + e + '"');
      	            this._nowrap && (g += ' nowrap="nowrap"');
      	            c && (g += ' style="' + c + '"');
      	            return g + ' class="' + a + '"'
      	        }
      		});//zk.override
      	});//zk.afterLoad
      

      Root Cause

      width style is not closed by semicolon
      https://github.com/zkoss/zk/blob/a9d091ed356824be23c86e69261fbf4b7796e183/zul/src/archive/web/js/zul/grid/Row.js#L207

      Workaround

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              wenninghsu wenninghsu
              Reporter:
              MDuchemin MDuchemin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: