1
votes

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');
}
2

2 Answers

7
votes

This should work

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

Sencha Touch stores the titles of the hidden views in the backButtonStack array on the navigation bar component. You can change the title at a certain index in the navigation view like this:

navView.getNavigationBar().backButtonStack[index] = newTitle;

I made a Gist with a function that takes care of the internals.