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

invisible listheaders are still visible in IE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 8.6.0
    • 8.5.1.2
    • None
    • Security Level: Jimmy
    • None
    • ZK 8.6.0 S1

      Steps to Reproduce

      1. run the attached zul with Edge (IE11 or IE9)

      Current Result

      • 1st and 6st listheader are visible
      • all listcells of hidden listheaders are still visible

      Expected Result

      all hidden listheader and listcell are hidden.

      Debug Information

      1. chrome and firefox has no such bug
      2. 8.5.2.FL.20180720-Eval doesn't solve this bug
      3. it seems that width: 0.1px; visibility:hidden can't hide a column in IE. see table.html

      Workaround

      1. Use <listheader hflex=""> instead of width="%"
      2. Apply the javascript

          zk.afterLoad('zul.mesh', function () {
              if (!zk.ie && !zk.edge) return; // Patch IE/Edge
      
              var xMeshWidget = {};
              zk.override(zul.mesh.MeshWidget.prototype, xMeshWidget, {
                  domFaker_: function (out, fakeId) { //used by redraw
                      var head = this.head;
                      out.push('<colgroup id="', head.uuid, fakeId, '">');
                      for (var w = head.firstChild; w; w = w.nextSibling) {
                          var wd = w._hflexWidth ? w._hflexWidth + 'px' : w.getWidth(),
                              visibility = w.isVisible() ? '' : 'visibility: collapse;';
                          if (!w.isVisible()) wd = '0';
                          // B70-ZK-2036: Style width should end with 'px'.
                          wd = wd != null ? 'width: ' + wd + ';' : '';
                          out.push('<col id="', w.uuid, fakeId, '" style="', wd, visibility, '"/>');
                      }
                      if (fakeId.indexOf('hd') > 0 || fakeId.indexOf('ft') > 0)
                          out.push('<col id="', head.uuid, fakeId, '-bar" style="width: 0px" />');
                      out.push('</colgroup>');
                  }
              });
      
              var xHeaderWidget = {};
              zk.override(zul.mesh.HeaderWidget.prototype, xHeaderWidget, {
                  bind_: function () {
                      this.$supers(zul.mesh.HeaderWidget, 'bind_', arguments);
                      if (this.parent.isSizable())
                          this._initsz();
                      var mesh = this.getMeshWidget();
                      if (mesh) {
                          var $n = jq(this.$n()),
                              $faker = jq(this.$n('hdfaker')),
                              w = this.getWidth();
                          if (!this.isVisible()) {
                              $n.css('display', '');
                              $faker.css('display', '');
                              $faker.css('visibility', 'collapse');
                              $faker.css('width', '0');
                          } else {
                              $faker.css('visibility', '');
                              // B70-ZK-2036: Check if header has hflex width first.
                              if (!this._hflexWidth && w) {
                                  $faker.css('width', w);
                              }
                          }
                      }
                      this.fixFaker_();
                  }
              });
          });
      

        1. hidden-listheader.png
          66 kB
          hawk
        2. t5805-2.zul
          0.9 kB
          hawk
        3. table.html
          2 kB
          hawk

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

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 1 week
                1w
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 5 hours, 30 minutes Time Not Required
                1d 5h 30m