javascript - 在我的选项卡面板中获取标题属性

标签 javascript extjs sencha-touch sencha-touch-2

我在 View 中有一个选项卡面板,并且选项卡面板中有许多选项卡,我想在 Controller 中获取标题字符串

我的标签面板代码:

        {
            xtype: 'tabpanel',
            itemId: 'tabfirst',
            flex: 1,
            //activeItem: 1,
            tabBar: {
                layout: {
                    pack: 'center'
                }
            },
            items: [
                {
                    title: 'tab1',//---------i want get it's value tab1
                    xtype: 'list',
                    itemTpl: '{title}',
                    data: [
                        {title : 'title1'},
                        {title : 'title2'},
                        {title : 'title3'}
                    ]
                },
                {
                    title: 'tab2',
                    html: 'here second html2'
                }
            ]
        }

在 Controller 启动函数代码中

    var moneytab = Ext.ComponentQuery.query('.makemoney #tabfirst')[0];
    console.log(moneytab.getItems().......how can i get the value of title........);

上面的 getItems 在我的 chrome 控制台中返回数组列表

enter image description here

我的标题在数组 1 中在项目中。THX

最佳答案

您不是查询选项卡,而是查询选项卡面板本身。您显示的项目是选项卡面板的项目,而不是选项卡的项目。

{
    xtype: 'tabpanel',
    itemId: 'myTabPanel',
    flex: 1,
    tabBar: {
        layout: {
            pack: 'center'
        }
    },
    items: [
        {
            title: 'tab1',
            xtype: 'list',
            itemId: 'myFirstTab',
            itemTpl: '{title}',
            data: [
                {title : 'title1'},
                {title : 'title2'},
                {title : 'title3'}
            ]
        },
        {
            title: 'tab2',
            html: 'here second html2'
        }
    ]
}

var tabPanel = Ext.ComponentQuery.query('#myTabPanel')[0],
    moneyTab = tabPanel.child('#myFirstTab');

console.log(moneyTab.getTitle());
moneyTab.setTitle('w00t');
console.log(moneyTab.getTitle());

关于javascript - 在我的选项卡面板中获取标题属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32560554/

相关文章:

javascript - document.querySelectorAll(变量类)

javascript - 当我清除 div 时,设置超时仍然运行

sencha-touch - compass - 获取生成的 Sprite 图的宽度和高度

javascript - 根据用户选择向 CQ5 对话框中的多字段动态添加验证

sencha-touch - Sencha Touch MVC 最佳实践

javascript - Sencha : Two lists showing different content from the same store. 可能吗?

list - 如何设置行高 Sencha Touch List

javascript - 使用 Angularjs 以编程方式通过名称将表单外部的输入发布到表单

javascript - 什么是 ExtJS 哲学?单页应用?

javascript - 当使用 Promise.reject 生成数组时,我得到了成功响应