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

notification cause parent/children issues after ZK-4130

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 8.6.4, 9.0.1
    • 8.6.1, 8.6.3
    • None
    • Security Level: Jean
    • None

      Steps to Reproduce

      Run fiddle

      http://zkfiddle.org/sample/j6r7iq/2-Another-new-ZK-fiddle

      Current Result

      When notifications are instantiated, they receive a this.parent=ref; value (where this is the notification widget and ref is the target component)

      This cause a number of issues with parent/children relationships. 

      For example, during notification.detach (when notification is closed or expires), the unlink method is called. Since the notification is not an actual child of the parent, it doesn't have the nextSibling and doesn't count toward parent.nChildren

      As a result, the parent component no longer finds any of it's actual children, since unlink sets the parent firstChild to null and the nChildren to 0. (unlink thinks the notification is the only child, and since it is being removed, sets the parent as no child)

      Other parent / child issues may appear

      Expected Result

      notification should either not interfere with parent / child relationships, or be treated as an actual child

      Debug Information

      To also check: popup and other similar widgets

      Workaround

      <script><![CDATA[ 
       zk.afterLoad('zul.wgt', function() {
        var xNotification = {};
        zk.override(zul.wgt.Notification.prototype, xNotification, {
         $init: function (owner, msg, opts) {
          this.$supers(zul.wgt.Notification, '$init', arguments);
          this.fakeParent = owner; //fake
          this._msg = msg;
          this._type = opts.type;
          this._ref = opts.ref;
          this._dur = opts.dur;
          this._closable = opts.closable;
         }
        });//zk.override
       });//zk.afterLoad
      ]]></script>

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

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 1 day, 4 hours
                1d 4h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 4 hours
                1d 4h