HZGN.COM
welcome to my space
X
Welcome to:hzgn.com
Search:  
 HOME   Tab is activated when close button clicked

Tab is activated when close button clicked

Published by: rose 2009-01-07

  • See Tabs Example 2 (http://extjs.com/deploy/ext/examples/tabs/tabs-adv.html).
    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.

    /** @private */
    closeClick : function(e){
    var o = {};
    e.stopEvent();
    this.fireEvent("beforeclose", this, o);
    if(o.cancel !== true){
    this.tabPanel.removeTab(this.id);
    }
    Jarte Options::
    Clickless Tab Close Button - Controls whether the Close button on the current documents tab can be activated by pausing the mouse over it.
    http://www.jarte.com/help_new/jarte_options.html
    HOME
    }


  • There's no difference. Ext.override puts the properties from the 2nd arg into the 1st arg's prototype. Ext.apply puts the properties from the 2nd arg into the 1st arg, so you just specify ".prototype" on the 1st arg.
    AN INTRODUCTION TO WEBCENTRAL::
    ยท Within the User Preferences screen, click the Add New Tab button. a webCentral session, remember to click the Logout button to close the session.
    http://www.du.edu/uts/training/materials/handouts/webcentral/introwebcentral.html
    HOME
    Steps For Setting up a Primary Election::
    On the Elections tab, click the [Elections] button. 3 Districts radio button (allows only those voters moved to the Activated
    http://www.dos.state.pa.us/sure/lib/sure/settingupaprimaryelection_0104.pdf
    HOME

    eureka! thanks for the tip :)


  • I don't think there's a bug in the Event object. It seems to return an HtmlElement, not an Ext.Element.

    It doess need documenting though. I'll have a go when I have time to study the code enough.


  • This works:


    Ext.override(Ext.TabPanelItem, {
    onTabMouseDown : function(e){
    e.preventDefault();
    var t = Ext.get(e.getTarget());
    if (!t.hasClass("close-icon")) {
    this.tabPanel.activate(this.id);
    }
    }
    });


  • Error: e.getTarget().hasClass is not a function
    Still works since the tab is activated onclick. but no longer on mousedown.

    Maybe you mean getTarget(false, false, true) (return a Ext.Element object instead of DOM node).

    But... this doesnt seem to work eather, I guess this is due to another bug in EventObject: It never returns a Ext.Element

    getTarget : function(selector, maxDepth, returnEl){
    return selector ? Ext.fly(this.target).findParent(selector, maxDepth, returnEl) : this.target;
    National Geographic: The Complete National Geographic FAQ::
    Click on the OK button and close the System Properties window. Click the Settings tab. Click on the Advanced button. Verify that the General tab is activated.
    http://www.nationalgeographic.com/cdrom/complete/cng10faq.html
    HOME
    }

    shoulnt this be something like
    Ext.override(Ext.EventObject, {
    getTarget : function(selector, maxDepth, returnEl){
    if(selector) {
    return Ext.fly(this.target).findParent(selector, maxDepth, returnEl);
    }
    else {
    return returnEl ? Ext.get(this.target) : this.target;
    }
    }
    });


  • 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?


  • Joris, false is not a valid selector. If you want an Ext.Element you will need to pass a valid selector. If you don't need the selector then like Animal posted, wrap it in an Ext.get or Ext.fly.


  • Hi @Animal, one last (unrelated) question.

    I've noticed in your code samples elsewhere that you also use Ext.apply() on an object's prototype, vs Ext.override() on an object's instance in your code sample above. Is this merely personal preference, or is there some reason behind it?


  • Ahah! That would be a mousedown which goes through this 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.


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


  • http://extjs.com/deploy/ext/docs/output/Ext.EventObject.html#getTarget

    public function getTarget([String selector], [Number/String/HTMLElement/Element maxDepth], [Boolean returnEl])

    * returnEl : Boolean
    (optional) True to return a Ext.Element object instead of DOM node


  • It does thank you.
    But isnt the other thing a bug as well?


  • Hi @Animal, one last (unrelated) question.

    I've noticed in your code samples elsewhere that you also use Ext.apply() on an object's prototype, vs Ext.override() on an object's instance in your code sample above. Is this merely personal preference, or is there some reason behind it?

    There's no difference. Ext.override puts the properties from the 2nd arg into the 1st arg's prototype. Ext.apply puts the properties from the 2nd arg into the 1st arg, so you just specify ".prototype" on the 1st arg.


  • I guess your totally right :D
    Nice one.


  • 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.


  • Try adding this code after including ext-all.js:


    Ext.override(Ext.TabPanelItem, {
    onTabMouseDown : function(e){
    e.preventDefault();
    if (!e.getTarget().hasClass("close-icon")) {
    this.tabPanel.activate(this.id);
    }
    }
    });





  • Red Hat's Rough Recovery From CFO Exit
    Windows Live Finds a New, Pre-installed Home

  • button css help
  • execute function from outside
  • multiple htmleditors in tabpanel won t render
  • tab panel rendering issue in ie
  • form validation on button click
  • apached gzip file problem ext all debug js
  • fixed width viewport
  • focus in form fields
  • problem with labels on components
  • tree grid within a panel within a tabpanel
  • how to format the display date
  • auto scroll
  • extjs object height and width percentages of parent
  •  
  • invisible accordion items
  • totalproperty with dwr
  • treeview leaf click event handler
  • get container handle from pre defined class
  • make a plain simple borderlayout
  • reset margin for east region
  • tree with ajax call to jsp
  • how to create button beside form field
  • filtering combox like states example
  • 1 1 2 1 textfield doesn t truncate at maxlength
  • paging grid not loading data
  • how to pre configure individual tabs
  • how to do save in extjs
  • why methods are not getting called
  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Tab is activated when close button clicked , Please add it free.
    About us |Contact us |Advertisement |Site map |Exchange links
    Copyright© 2008hzgn.com All Rights Reserved