Results 1 to 2 of 2

Thread: Programmatically change Toolbar tbtext data with a template

  1. #1
    Sencha User
    Join Date
    Sep 2015
    Location
    Antwerp
    Posts
    12
    Answers
    1

    Default Answered: Programmatically change Toolbar tbtext data with a template

    Hello,

    I have a toolbar with next item:

    PHP Code:
    items 
    [ {
                            
    margin '0 0 0 0',
                            
    xtype 'tbtext',
                            
    id 'header-toolbar-login-text',
                            
    tpl '{text}',
                            
    data : {
                                
    text 'UserName'
                            
    },
                            
    cls 'top-user-name'
    }] 
    I try to dynamically change the text of this item, using the render listener:

    PHP Code:
     listeners : {
            
    render : function(){

            var 
    newData = {
                
    text 'Mr. Sencha Noob'
            
    };

            
    Ext.getCmp('header-toolbar-login-text').setData(newData );
           
    // Ext.getCmp('header-toolbar-login-text').update(newData );

          
    }

    }, 
    I tried both setData and/or update but without any success.
    Who can help Mr. Sencha noob?

  2. I found the solution myself. I need to do it in the afterrender event !!

  3. #2
    Sencha User
    Join Date
    Sep 2015
    Location
    Antwerp
    Posts
    12
    Answers
    1

    Default

    I found the solution myself. I need to do it in the afterrender event !!

Similar Threads

  1. Replies: 4
    Last Post: 15 Feb 2013, 11:17 AM
  2. tbtext inside toolbar having problem in IE
    By devkumar123 in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 3 Sep 2012, 8:12 AM
  3. Allow only programmatically tab change
    By eevee in forum Ext: Discussion
    Replies: 2
    Last Post: 22 Dec 2011, 2:00 AM
  4. Add Toolbar to panel programmatically
    By Eugene Krivopaltsev in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 24 Oct 2010, 12:53 PM

Tags for this Thread

Posting Permissions

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