1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    2
    Vote Rating
    0
    jiyee is on a distinguished road

      0  

    Default How to setTitle of the tabPanel when I listen the treePanel click event

    How to setTitle of the tabPanel when I listen the treePanel click event


    In my application, there are a treepanel and a tabpanel, when i click the item of treepanel, i want to change the title of the activetab.
    i write the code below:
    PHP Code:
    schemeTree.on('itemdblclick', function(viewrecorditemindexe) {
    tabs.activeTab.setTitle('Something new');

    but it didn't works, any guides could offer?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,549
    Vote Rating
    873
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Currently you have to call doLayout however there was a bug reported and is pending verification of the fix so it should make it in the next release.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha Premium Member tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,695
    Vote Rating
    114
    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


    hi mitchel,

    i also experienced this issue. i tried doLayout() on the tabPanel and on the tab as well and the title stayed the same.

    so, i am opening a bugreport just to make sure.


    best regards
    tobiu
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,549
    Vote Rating
    873
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Tested on Beta3 here are two overrides that work for me:

    Code:
    Ext.override(Ext.panel.Panel, {
        setTitle: function(newTitle) {
            var me = this;
    
            me.callOverridden(arguments);
    
            if (Ext.isDefined(me.tab)) {
                me.tab.setText(newTitle);
            }
        }
    });
    Ext.override(Ext.container.Container, {
        setTitle: function(newTitle) {
            var me = this;
    
            if (Ext.isDefined(me.tab)) {
                me.tab.setText(newTitle);
            }
        }
    });
    The reason there is an override on Ext.container.Container is because Ext.container.Container doesn't have a setTitle method so I had to add one.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha Premium Member tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,695
    Vote Rating
    114
    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


    hi mitchel,

    looks good. i would also include the doLayout-calls (at least for beta3):
    Code:
    Ext.override(Ext.panel.Panel, {
        setTitle: function(newTitle) {
            var me = this;
    
            me.callOverridden(arguments);
    
            if (Ext.isDefined(me.tab)) {
                me.tab.setText(newTitle);
                me.doLayout();
            }
        }
    });
    Ext.override(Ext.container.Container, {
        setTitle: function(newTitle) {
            var me = this;
    
            if (Ext.isDefined(me.tab)) {
                me.tab.setText(newTitle);
                me.doLayout();
            }
        }
    });

    best regards
    tobiu
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

Similar Threads

  1. can't get tabPanel to listen for a itemtap/click.
    By aondevuser1 in forum Sencha Touch 1.x: Discussion
    Replies: 0
    Last Post: 10 Mar 2011, 8:10 AM
  2. Load content into TabPanel based on a Click event in a TreePanel
    By Markj in forum Ext 3.x: Help & Discussion
    Replies: 11
    Last Post: 22 Oct 2010, 12:59 AM
  3. how to listen to the event while the label of a tabpanel is being closed
    By sunz2009 in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 7 Mar 2009, 7:00 PM
  4. GridPanel D&D to TreePanel : what event to listen to?
    By david.james in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 28 Mar 2008, 10:07 AM

Thread Participants: 2