Question

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');
}
Was it helpful?

Solution

This should work

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top