2012-08-10 97 views
1

我已经实现了我的应用程序在煎茶触摸如何设置标题面板的导航栏动态

在我的板,我有一个导航栏,我想在面板接头动态设置标题

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' 
       } 
       ] 
}, 

和initcomponent方法实现的代码来获得这样

组件
initComponent: function(component, options, wstitle) { 


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

[如何在Sencha Touch上动态定义NavigationView的标题?](http://stackoverflow.com/questions/11818641/how-to-define-dynamically-the-title-in-a- navigationview-on-sencha-touch) – 2012-08-10 12:25:15

回答

7

这应该工作

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

这附加另一个标题栏到我的导航栏..我得到了标题,但idnt想要两个标题栏 – user1425472 2012-08-10 05:16:30

+0

我看不到在你的代码中的导航栏。你能把它放? – blessenm 2012-08-10 05:18:04

+0

alrady我在前面板导航..当我们在这里可疑面板上的列表项目时,导航栏自动带有后退按钮 – user1425472 2012-08-10 05:23:01

0

煎茶触摸存储的backButtonStack阵列的导航栏组件的隐藏视图的标题。与采取内部的护理有关的功能

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

I made a Gist:您可以在一定的指数在这样的导航视图中更改标题。