Results 1 to 5 of 5

Thread: How to set title for a dockedItem (toolbar) ,not on creation?

  1. #1
    Sencha User
    Join Date
    Jun 2011
    Location
    Los Angeles, CA
    Posts
    19

    Default How to set title for a dockedItem (toolbar) ,not on creation?

    I've got a panel with a dockedItem toolbar and I set the title of the toolbar to be "restaurant".
    How do I edit the title on runtime?
    Tnx

    Code:
      
    FoodoApp.detailPanel = new Ext.Panel({
                id: 'detailpanel',
                tpl: ['<h>{Restaurant}</h>',
                      buy
                     ],
                dockedItems: [
                    {
                        xtype: 'toolbar',
                        title: 'restaurant',
                        items: [{
                            text: 'back',
                            ui: 'back',
                            handler: function() {
                              }
                              }}]
    }

  2. #2
    Touch Premium Member
    Join Date
    Sep 2008
    Location
    Orange County, CA, USA
    Posts
    186

    Default setTitle

    In a listener you can..
    this.dockedItems.items[0].setTitle("Test");

    Most anywhere you can...
    Ext.getCmp('detailpanel').dockedItems.items[0].setTitle("Test");

    I would suggest just giving the toolbar an ID,

    Ext.getCmp('toolbarid').setTitle('newTitle');

  3. #3
    Sencha User
    Join Date
    Jun 2011
    Location
    Los Angeles, CA
    Posts
    19

    Default

    That worked great!
    I've set the id for the toolbar.
    Thank you.

  4. #4
    Sencha User
    Join Date
    Jun 2011
    Posts
    52

    Default

    Quote Originally Posted by Jack9 View Post
    In a listener you can..
    this.dockedItems.items[0].setTitle("Test");
    Hello,
    This worked out great, but I would like to have setTitle to be dynamically rendered.
    So I have a listener in my controller, on activate setTitle will be fired. I have data object ready. Please see code below
    Code:
    this.render({
                    xtype: 'storelistdetail',
                    data: record.data,
                    listeners:{
                        activate: function(??){
                            this.dockedItems.items[0].setTitle(??);
                        },
                    
                        deactivate: function(details) {
                            details.destroy();
                        }                        
                    }
    })
    I am very excited about Sencha Touch and just beginning to understand MVC concept with it as well. Appreciate the help in advance.

  5. #5
    Sencha User
    Join Date
    Jun 2011
    Posts
    52

    Default

    I just edited :

    this.dockedItems.items[0].setTitle(record.get('StoreCode');

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
  •