Changeset 523

Show
Ignore:
Timestamp:
08/07/07 23:33:21 (1 year ago)
Author:
ian
Message:

pulled the sizing and alignment code out of the 'show' method and made a 'resize' method, which might be useful later on to resize the menu over the same tree node - in the event that the tree node has grown or moved

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • pagoda/trunk/Pagoda/pagoda/widgets/admin/static/javascript/tree_menu.js

    r522 r523  
    2828        // Remember which element this menu is attached to 
    2929        this.alignEl = Ext.get(element); 
     30        this.position = position; 
    3031 
    3132        // Ensure that this menu has been rendered 
     
    3738        this.fireEvent("beforeshow", this); 
    3839 
    39         // Align this menu over 'element' with enough padding to fly out 
    40         var align_position = (position == 'r') ? 'tl-tl' : 'tr-tr'; 
    41         this.el.alignTo(this.alignEl, align_position); 
    42         var padding_position = (position == 'r') ? 'padding-left' : 'padding-right'; 
    43         this.el.setStyle(padding_position, this.alignEl.getWidth() + 'px'); 
    44  
    45         // Set z-index of menu and element so the menu appears behind 'element' 
    46         this.alignEl.setStyle('z-index', '15000'); 
    47         this.el.setStyle('z-index', '14999'); 
     40        // Size and Align the menu as appropriate 
     41        this.resize(); 
    4842 
    4943        // Show the menu 
     
    5448        this.fireEvent("show", this); 
    5549 
     50    }, 
     51    // Resize and realign the menu to the last tree node to have been 
     52    // passed into the 'show' method. 
     53    resize: function() { 
     54        // Align this menu over 'element' with enough padding to fly out 
     55        var align_position = (this.position == 'r') ? 'tl-tl' : 'tr-tr'; 
     56        this.el.alignTo(this.alignEl, align_position); 
     57        var padding_position = (this.position == 'r') ? 'padding-left' : 'padding-right'; 
     58        this.el.setStyle(padding_position, this.alignEl.getWidth() + 'px'); 
     59 
     60        // Set z-index of menu and element so the menu appears behind 'element' 
     61        this.alignEl.setStyle('z-index', '15000'); 
     62        this.el.setStyle('z-index', '14999'); 
    5663    }, 
    5764    // Attach this menu to the specified tree, adding event handlers 

Log in as guest/pagoda to create tickets