Reputation: 333
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
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');
}
Upvotes: 1
Views: 4202
Reputation: 6414
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.
Upvotes: 0
Reputation: 31779
This should work
bar.getParent().getNavigationBar().setTitle('Your Title');
Upvotes: 7