michele
michele

Reputation: 26598

Sencha change Ext.Panel title dynamically

How can I change listpanel title dynamically? I have a navigationview where listpanel is the item. So the navigation bar display the panel title that i would change dynamically.

image: http://postimage.org/image/evxdv8fh9/

Thanks.

listpanel = new Ext.Panel({
                       layout: 'fit',   
                       id:'listpanel',
                       title:'change this title dinamically',
                       items: [
                               {
                                   xtype: 'titlebar',
                                   id: 'myTitle',
                                   docked: 'top',
                                   title: 'title1'
                               },
                               { xtype: 'titlebar',
                                   id: 'myMeanConsumption',
                                   docked: 'bottom',
                                   title: 'title2'
                               },
                                   list
                               ]
                   });

Upvotes: 0

Views: 8658

Answers (2)

qun
qun

Reputation: 1

Add this after the listpanel is created:

listpanel.onAfter('painted', function () { 
listpanel.getNavigationBar().setTitle(newTitle); },  listpanel, { delay: 100 });

Upvotes: 0

Saurabh Gokhale
Saurabh Gokhale

Reputation: 46395

Do like this,

Ext.getCmp('myTitle').setTitle('Changed Title');

EDIT :

title property is not available on Ext.Panel component. Hence, the below line is redundant.

title:'change this title dinamically',

You need to change the title of titlebar only which I already mentioned above.

I cannot see the listpanel title.

enter image description here

Upvotes: 1

Related Questions