Results 1 to 10 of 20

Thread: Tab is activated when close button clicked

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Mar 2007
    Posts
    464
    Vote Rating
    1
      0  

    Default Tab is activated when close button clicked

    See Tabs Example 2.
    When you close tab that is not the active one, it will be activated before its closed.

    stopEvent() should prevent the tab from receiving the click event. but somehow this doesnt work I think.

    PHP Code:
        /** @private */
        
    closeClick : function(e){
            var 
    = {};
            
    e.stopEvent();
            
    this.fireEvent("beforeclose"thiso);
            if(
    o.cancel !== true){
                
    this.tabPanel.removeTab(this.id);
            }
        } 

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    6,956
    Vote Rating
    20
      0  

    Default

    I don't see this behavior. The click event for the close icon would fire first (even if it bubbles) and it removes the tab.
    Jack Slocum
    Sencha Co-Founder, Ext JS Founder
    Original author of Ext JS 1, 2 & 3.
    Twitter: @jackslocum

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Posts
    464
    Vote Rating
    1
      0  

    Default

    Hm I really do, try holding your mouse button for a sec when clicking the close button.

  4. #4
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
      0  

    Default

    yeah tried holding the mouse button and it does what u say.

    however.... if you press and hold down your mouse button, is it still considered a click?

  5. #5
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,615
    Vote Rating
    54
      0  

    Default

    Ahah! That would be a mousedown which goes through this code:

    Code:
        onTabMouseDown : function(e){
            e.preventDefault();
            this.tabPanel.activate(this.id);
        },
    Perhaps that could check the target, and only activate if the original target was not the close button.

  6. #6
    Sencha User
    Join Date
    Mar 2007
    Posts
    464
    Vote Rating
    1
      0  

    Default

    I guess your totally right
    Nice one.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •