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

When maximize the panel in portallayout, add another panel will cause js error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 7.0.3
    • 7.0.2
    • None
    • None

      How to reproduce:
      1. Go to http://www.zkoss.org/zkdemo/layout/business_portal
      2. Maximize any panel
      3. Click add

      Workaround: add the following code to zul

      <script><![CDATA[
      zk.afterLoad("zkmax.layout", function () {
        var _xPortallayout = {};
      
        zk.override(zkmax.layout.Portallayout.prototype, _xPortallayout, {
          render: _zkf = function() {
            var cmp = this.$n();
            if (!zk(cmp).isRealVisible()) 
              return;
            
            var vert = this.isVertical(),
              total = vert ? cmp.offsetWidth : cmp.offsetHeight,
              cns = jq(cmp).find('>div:first')[0],
              portalChildren;
            
            for( ; cns; cns = jq(cns).next('div:first')[0]) {
              portalChildren = zk.Widget.$(cns.id);
              if (portalChildren.desktop && zkmax.layout.Portallayout.isInstance(portalChildren)) {
                var oriSize = portalChildren._oriSize;
                if (oriSize.indexOf('px') > 0)
                  total -= vert ? cns.offsetWidth : cns.offsetHeight;
              }
            }
            
            total = Math.max(0, total);
            
            cns = jq(cmp).find('>div:first')[0];
            for( ; cns; cns = jq(cns).next('div:first')[0]) {
              portalChildren = zk.Widget.$(cns.id);
              if (portalChildren.desktop && zkmax.layout.Portallayout.isInstance(portalChildren)) {
                var oriSize = portalChildren._oriSize;
                if (oriSize.indexOf('%') > 0) {
                  cns.style[vert ? 'width' : 'height'] = jq.px0((Math.floor(zk.parseInt(oriSize) / 100 * total)) - 1);
                }
              }
            }
          },
          onSize: _zkf,
        });
      });
      ]]></script>
      

            jumperchen jumperchen
            RaymondChao RaymondChao
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: