1. #61
    Ext JS Premium Member
    Join Date
    Sep 2011
    Posts
    25
    Vote Rating
    0
    dmurat is on a distinguished road

      0  

    Default


    Hi,

    I'm having problems with running this extension under Ext 4.1.0.RC2. Basically, I have a button which shows and hides notification, where notification is instantiated on first show and reused later for consecutive show() calls. On first notification.show(), everything is ok, but on every consecutive show(), I'm getting -10000 from a call me.getXposAlignedToManager() in beforeShow handler.

    I was able to getting it work again (at least for my case) with following modification:
    Code:
    beforeShow: function() {
        var me = this;
        // ...
        
        me.xPosOld = me.xPos;
        if (notifications.length) {
          me.el.alignTo(notifications[notifications.length - 1].el, me.siblingAlignment, [0, 0]);
          me.xPos = me.getXposAlignedToSibling(notifications[notifications.length - 1]);
          me.yPos = me.getYposAlignedToSibling(notifications[notifications.length - 1]);
        } else {
          me.el.alignTo(me.manager.el, me.managerAlignment, [(me.paddingX * me.paddingFactorX), (me.paddingY * me.paddingFactorY)]);
          me.xPos = me.getXposAlignedToManager();
          me.yPos = me.getYposAlignedToManager();
        }
    
        if (me.xPos === -10000) {
          me.xPos = me.xPosOld;
        }
    
        // ...
    }
    Does anybody else experience same problems with 4.1.0.RC2? Tnx

    Best regards,
    Damir Murat

  2. #62
    Ext JS Premium Member
    Join Date
    Sep 2011
    Posts
    25
    Vote Rating
    0
    dmurat is on a distinguished road

      0  

    Default


    As it turns out, 4.1.0-rc2 changed visibility mode to 'offsets' for Window class. For restoring correct behavior of Notification, I just set hideMode to 'visibility' in Notification's definition:

    Code:
    Ext.define('Ext.ux.window.Notification', {
      extend: 'Ext.window.Window',
      alias: 'widget.uxNotification',
    
      hideMode: 'visibility',
      cls: 'ux-notification-window',
      
      //...
    
    });
    After that, Notification's behavior is restored to normal, as it was before 4.1.0-rc2.

    Damir Murat

  3. #63
    Sencha User
    Join Date
    Jul 2011
    Posts
    4
    Vote Rating
    0
    jiashaoshan@gmail.com is on a distinguished road

      0  

    Default base on Ext js 3.*?

    base on Ext js 3.*?


    do u hava this extension base on Extjs 3.*? i try to rewrite this on 3.* ,bug it looks like difficult

  4. #64
    Sencha User eirik.lorentsen's Avatar
    Join Date
    Aug 2011
    Location
    Santiago, Chile
    Posts
    33
    Vote Rating
    7
    eirik.lorentsen is on a distinguished road

      0  

    Default


    Quote Originally Posted by jiashaoshan@gmail.com View Post
    do u hava this extension base on Extjs 3.*? i try to rewrite this on 3.* ,bug it looks like difficult
    Yes. Efattal has authored a 3.x Notification extension:
    http://www.sencha.com/forum/showthre...x.Notification
    This was the inspiration for the 4.x version.

  5. #65
    Sencha User
    Join Date
    Sep 2011
    Posts
    25
    Vote Rating
    2
    dcohn is on a distinguished road

      0  

    Default


    Did you ever figure out how to destroy the notifications after hiding? I'm going to be creating a lot of notifications, I don't want all of the old ones eating up memory once they are hidden.

  6. #66
    Sencha User eirik.lorentsen's Avatar
    Join Date
    Aug 2011
    Location
    Santiago, Chile
    Posts
    33
    Vote Rating
    7
    eirik.lorentsen is on a distinguished road

      0  

    Default


    Quote Originally Posted by dcohn View Post
    Did you ever figure out how to destroy the notifications after hiding? I'm going to be creating a lot of notifications, I don't want all of the old ones eating up memory once they are hidden.
    I'll have a look at this as soon as I can find some spare time

  7. #67
    Sencha User
    Join Date
    Nov 2011
    Location
    France
    Posts
    10
    Vote Rating
    0
    hpsam is on a distinguished road

      0  

    Default


    @dcohn: If I look at the code, the beforehide listener call the destroy. The destroy animate the notification (make it disappear) and then afteranimate call the parent destroy.
    So when notification is hidden, it's destroyed.

  8. #68
    Sencha User
    Join Date
    Jun 2010
    Location
    Buenos Aires, Argentina
    Posts
    213
    Vote Rating
    9
    ldonofrio will become famous soon enough

      0  

    Default


    I think that you're wrong, look at the dom, markup is still there!
    My fix for this, in afteranimate listener add me.destroy at the end:
    PHP Code:
                        afteranimate: function () {
                            if (
    me.manager) {
                                var 
    notifications me.getNotifications(me.managerAlignment);
                                var 
    index Ext.Array.indexOf(notificationsme);
                                if (
    index != -1) {
                                    
    Ext.Array.erase(notificationsindex1);
                                    
    // Slide "down" all notifications "above" the hidden one
                                    
    for (;index notifications.lengthindex++) {
                                        
    notifications[index].slideBack();
                                    }
                                }
                            }

                            
    me.readyToHide true;
                            
    // 2012-05-22 By Ing. Leonardo D'Onofrio (leonardo_donofrio at hotmail.com)
                            
    me.destroy();
                            
    // end
                        

    Quote Originally Posted by hpsam View Post
    @dcohn: If I look at the code, the beforehide listener call the destroy. The destroy animate the notification (make it disappear) and then afteranimate call the parent destroy.
    So when notification is hidden, it's destroyed.
    Last edited by ldonofrio; 22 May 2012 at 5:47 AM. Reason: fix

  9. #69
    Sencha User
    Join Date
    Nov 2011
    Location
    France
    Posts
    10
    Vote Rating
    0
    hpsam is on a distinguished road

      0  

    Default


    I look the code in my app see that I use the version 1.3 of Notification. I haven't seen that a 2.0 version exist.
    You're right in the new version the call to destroy is not present.
    But they are other changes, and I think the call to destroy must not be in afteranimate but a few lines lower. Like this when animation ended, Ext.Window (parent of Notification) hide() is called, beforehide and hide event are fired and then Notification is destroyed.
    PHP Code:
          me.readyToHide true;
          
    me.hide();
         }
        }
       });
      }

      
    // Calling parents hide function to complete hiding
      
    if (me.readyToHide) {
       
    me.isHiding false;
       
    me.readyToHide false;
       
    me.removeCls('notification-fixed');
       
    this.callParent(arguments);
    //hpsam: call to destroy after all hide actions are done.
       
    me.destroy();
      } 


  10. #70
    Sencha User eirik.lorentsen's Avatar
    Join Date
    Aug 2011
    Location
    Santiago, Chile
    Posts
    33
    Vote Rating
    7
    eirik.lorentsen is on a distinguished road

      0  

    Default


    hpsam, dmurat, idonofrio:

    I have sorted out the problem with destruction and reuse. The notifications now destroy their dom by default unless closeAction is set to 'hide' in which case the notification never destroys and will allow for repeated update() and show() calls.

    I also updated the demo with an example of reuse.