Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext JS Premium Member htammen's Avatar
    Join Date
    Jul 2010
    Location
    Germany, Hannover
    Posts
    74
    Vote Rating
    0
    htammen is on a distinguished road

      0  

    Default [CLOSED]Strange behaviour: Window, closeAction and ComponentQuery

    [CLOSED]Strange behaviour: Window, closeAction and ComponentQuery


    I´m using a Window as modal dialog:

    PHP Code:
    Ext.define('SO.ux.client.UserAddUi', {
        
    extend'Ext.Window',
        
    title'Benutzer hinzufügen',
        
    width600,
        
    height300,
        
    minHeight300,
        
    layout'border',
        
    modaltrue,
        
    id'userAddWindow',
        
    dockedItems: [{
            
    xtype'toolbar',
            
    dock'top',
            
    items: [{
                
    xtype'button',
                
    text'Hinzufügen',
                
    icon'../images/icons/user--plus.png',
                
    id'btnAddUsers'
            
    }]
        }],
        
    items: [
                {
                  ...
                }
               ]

    In initComponent I set a click handler for the toolbar button btnAddUsers
    PHP Code:
        ,initComponent: function() {
            
    SO.ux.client.UserAdd.superclass.initComponent.call(this);
            
    this.down('#btnAddUsers').on('click'this.addUsersHandlerthis);
        } 
    This works the first time the user opens the window. From the second time on this.down returns null and thus the window is not opened.

  2. #2
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,669
    Vote Rating
    110
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    this is not directly related to your problem, but you should really use itemId instead of id (and then parent.getComponent(itemId)). Otherwise you indirectly create a singleton, since each further instance would get the same dom-id.

    also prefer iconCls over icon.


    best regards
    tobiu
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

  3. #3
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,499
    Vote Rating
    46
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    It is to do with duplicate ids if the closeAction of that Window is not 'hide'.

    That Window should be closeAction: 'hide', and only created once.

  4. #4
    Ext JS Premium Member htammen's Avatar
    Join Date
    Jul 2010
    Location
    Germany, Hannover
    Posts
    74
    Vote Rating
    0
    htammen is on a distinguished road

      0  

    Default


    O.k. I´ve refactored from id to itemId. Thank you for the hint I wasn´t aware of that.

    But I don´t really understand that I have to use closeAction = 'hide'. The dialog is used very seldom and so I would like to destroy the window to save resources after it has been closed by the user. If I do this with all my widgets the user will run out of memory at some point.

  5. #5
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,814
    Vote Rating
    607
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Don't put non primitives in the object prototype (arrays, objects). This means they get shared across all instances.

    Put them inside initComponent.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  6. #6
    Ext JS Premium Member htammen's Avatar
    Join Date
    Jul 2010
    Location
    Germany, Hannover
    Posts
    74
    Vote Rating
    0
    htammen is on a distinguished road

      0  

    Default


    ??? don´t understand your last reply evant.
    This may be caused in my bad javascript know how. Can you explain in some words what I´m doing wrong and what I should do instead?
    Sorry for those basic question.

  7. #7
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,669
    Vote Rating
    110
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    maybe saki's example helps in this case:
    http://blog.extjs.eu/patterns/file-p...-file-pattern/
    look how he uses the initComponent-method.

    or get jay's book -> ext js in action.

    since there are no real classes in javascript, we are dealing with prototypes all the time. if you define a prototype, you can only add primitive datatypes (numbers, strings, booleans), but no arrays / objects as evan told you already. if you do so, every time you create a new instance with the new operator, it will get the identical array / object and this can get really bad if you are not dealing with singletons.


    best regards
    tobiu
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

Similar Threads

  1. Replies: 1
    Last Post: 17 Jun 2010, 4:09 PM
  2. [CLOSED] Strange behaviour on Combo and Grid
    By erikhedb in forum Ext GWT: Bugs (2.x)
    Replies: 3
    Last Post: 5 Oct 2009, 1:37 AM
  3. Replies: 4
    Last Post: 16 Jun 2009, 6:11 AM
  4. Strange behaviour with Ext.Window
    By DoS in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 19 Mar 2009, 11:32 AM

Thread Participants: 3

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi