Sencha touch Sencha Touch-使用setActiveItem()切换项目时,如何访问后退按钮?

Sencha touch Sencha Touch-使用setActiveItem()切换项目时,如何访问后退按钮?,sencha-touch,Sencha Touch,问题: 我使用setActiveItem()根据上的问题答案切换面板 一切正常,但我如何访问我的后退按钮 我怀疑只有一个后退按钮,我必须更改他的属性(文本、处理程序)。 我该怎么做 谢谢你,什洛米 另外,当我考虑它时,我必须修改所有的酒吧属性——它的标题 { xtype: 'button', text: 'Back', handler: function () { App.views.viewport.setActiveItem([The panel yo

问题:

我使用setActiveItem()根据上的问题答案切换面板

一切正常,但我如何访问我的后退按钮

我怀疑只有一个后退按钮,我必须更改他的属性(文本、处理程序)。 我该怎么做

谢谢你,什洛米

另外,当我考虑它时,我必须修改所有的酒吧属性——它的标题

{
    xtype: 'button',
    text: 'Back',
    handler: function () {
        App.views.viewport.setActiveItem([The panel you want to go], {type: 'slide', direction: 'right'});
    }
}

在“App.views.viewport”面板中添加一个按钮。

我将参考

首先在面板的顶部栏中添加一个后退按钮

initComponent: function () {
      Ext.apply(this, {
       dockedItems: [{
            xtype: "toolbar",
            title: "Ingressos",
            items:[{
                 xtype: 'button',
                 text: 'Back',
                 handler: function () {

                 }
            }]
       }],
       items: [Mobz.views.IngressosList]
    });
   Mobz.views.Ingressos.superclass.initComponent.apply(this, arguments);
}
之后,当用户转到下一页时,访问“后退”按钮并更改其处理程序(我不喜欢更改处理程序,我更喜欢构建一个堆栈机制以转到bacward,但这是您的选择:)

你正在寻找后退按钮

Mobz.views.viewport.getActiveItem().dockedItems.items[0].items.items[0] // back button

Mobz.views.viewport.getActiveItem().dockedItems.items[0].title // toolbars title

谢谢@ykartal,一如既往!我将按顺序挖掘堆栈。我是在发表这个问题后才发现的。谢谢。你说的堆栈机制是指prev()方法吗?我想是的。如果您在数组中保留以前的面板,然后单击“上一步”按钮,则将最后一个面板从数组中删除,然后在“前进”时打开新窗口并将其添加到数组中。但prev()是否足够?prev()不是保存堆栈顺序吗?非常感谢,我的土耳其朋友:)数组完成了任务。我花了很长时间才到达。我研究了不同的方法,但那似乎是最有效的,谢谢!
Mobz.views.viewport.getActiveItem() //panel

Mobz.views.viewport.getActiveItem().dockedItems.items[0] // toolbar
Mobz.views.viewport.getActiveItem().dockedItems.items[0].items.items[0] // back button

Mobz.views.viewport.getActiveItem().dockedItems.items[0].title // toolbars title