sencha-touchextjssencha-touch-2sencha-touch-theming

How to set the title for the navigation bar of the panel dynamically


I have implemented my application in sencha touch

in my panel i have a navigation bar i want to set title dynamically on panel header

enter image description here

 Ext.define('FleetSyncApp.view.WSMachineTypes', {

        extend: 'Ext.Panel',
        alias: 'widget.wsmachinetypes',
          id: 'myPanel',


    config: {
        layout: {
                   type: 'vbox'
                },

        items: [


            {
                title: 'Contact information',
                xtype: 'list',

----
----
-----


    }
],
    listeners: [
                {
                    fn: 'initComponent',
                    event: 'initialize'
                }
                ]
},

and in initcomponent method implemented code to get the component like this

    initComponent: function(component, options, wstitle) {


           var bar = Ext.getCmp('myPanel');
}

Solution

  • This should work

    bar.getParent().getNavigationBar().setTitle('Your Title');