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

widget setVisible doesn't trigger a resize event to the ancestors

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Won't Do
    • Icon: Normal Normal
    • None
    • 6.5.8.1, 9.0.1.2
    • None
    • Security Level: Jimmy
    • None
    • ZK 9.5.1 S1

      Steps to Reproduce

      Run fiddle

      https://zkfiddle.org/sample/3r1hj1u/1-setVisible-doesn-t-trigger-parent-size-event

      click 1st button

      Current Result

      test2 is hidden

      parent doesn't resize, test3 doesn't resize

      updated to feature:
      see the doc below
      https://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/util/Clients.html#resize-org.zkoss.zk.ui.Component-

      the flex=min part won't resize is expected.
      Not only setVisible, any action that will cause the size changed need to call Clients.resize(parent) by them self.

      Expected Result

      ancestors should resize.

      components synced to anscestors (such as flexing siblings) should resize.

      updated to feature:
      ZK being the UI framework, it feels wrong to ask the user to trigger these resizing themselves.
      The whole point of flex is that the end-user doesn't need to control the UI manually.
      Try to find a solution that user doesn't need to trigger these resizing themselves without performance impact.

      Debug Information

       

      Workaround

      <script><![CDATA[ 
          zk.afterLoad("zul.wgt", function () {
              var _xDiv = {};
              zk.override(zul.wgt.Div.prototype, _xDiv, {
                  setVisible: function() {
                      var result = _xDiv.setVisible.apply(this, arguments);
                      zUtl.fireSized(this.parent);
                      return result;
                  }
               });
          });
      ]]></script>
      

            Leon03 Leon03
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: