【问题标题】:How to set the title for the navigation bar of the panel dynamically如何动态设置面板导航栏的标题
【发布时间】:2016-12-26 02:38:00
【问题描述】:

我已经在 sencha touch

中实现了我的应用程序

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

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

【问题讨论】:

标签: sencha-touch extjs sencha-touch-2 sencha-touch-theming


【解决方案1】:

这应该可行

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

【讨论】:

  • 这会将另一个标题栏附加到我的导航栏.. 我得到了标题但不想要 2 个标题栏
  • alrady 我在前一个面板上有导航.. 当我们在前一个面板上分割一个列表项时,导航栏会自动带有后退按钮
【解决方案2】:

Sencha Touch 将隐藏视图的标题存储在导航栏组件的backButtonStack 数组中。您可以像这样在导航视图中更改某个索引处的标题:

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

I made a Gist 带有一个负责内部处理的函数。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-17
    • 2013-08-15
    • 1970-01-01
    • 2011-04-23
    • 2016-04-02
    相关资源
    最近更新 更多