链接到 Sencha Touch 中新面板的按钮

发布于 2024-11-15 04:24:16 字数 707 浏览 3 评论 0原文

请原谅我的天真。我正在尝试将工具栏上的按钮链接到新卡,而不是选项卡面板。新卡将具有与家庭不同的面板元素我已经观看了所有视频图并阅读了这里的几篇文章,但不知何故从未完全设法对其进行排序。

new Ext.Application({
        name: 'Demo App',
        launch: function() {
        this.viewport = new Ext.TabPanel({
           fullscreen: true,
           id: 'mainPanel',
           html: 'Welcome',
           cls: 'homescreen',
           dockedItems: [{
              xtype: 'toolbar',
              ui: 'light',
              title: 'Home',
              items: [
                 {text: 'Option1', ui: 'action',  flex: 1},
                 {xtype: 'spacer', },
                 {text: 'Option2', ui: 'action',flex: 1 }
              ]
           }]
        }); 
    }
});

pardon my naivety here. I'm trying to make buttons on a ToolBar link to a new card as opposed to TabPanels. The new card will have different panel elements than the home I've watched all the video tuts and read several articles on here, yet somehow never quite manage to get it sorted.

new Ext.Application({
        name: 'Demo App',
        launch: function() {
        this.viewport = new Ext.TabPanel({
           fullscreen: true,
           id: 'mainPanel',
           html: 'Welcome',
           cls: 'homescreen',
           dockedItems: [{
              xtype: 'toolbar',
              ui: 'light',
              title: 'Home',
              items: [
                 {text: 'Option1', ui: 'action',  flex: 1},
                 {xtype: 'spacer', },
                 {text: 'Option2', ui: 'action',flex: 1 }
              ]
           }]
        }); 
    }
});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七颜 2024-11-22 04:24:16

这并不是选项卡面板的真正意义。它应该将卡片加载到主面板中并让您在它们之间移动。您可以通过拦截卡开关并渲染新的单独面板来加载新的全屏面板(可能有自己的选项卡面板或其他元素),如下所示:

new Ext.Application({
    name: 'Demo App',
    launch: function() {
        this.viewport = new Ext.TabPanel({
            fullscreen: true,
            id: 'mainPanel',
            cls: 'homescreen',
            items: [{
                title   : 'Home',
                html    : 'Welcome'
            },{
                title   : 'Full screen'
            }],
            listeners   : {
                beforecardswitch : function (ct, newcard, oldcard) {
                    if (newcard.title == 'Full screen') {
                        var panel = new Ext.Panel({
                            fullscreen  : true,
                            dockedItems : [{
                                xtype   : 'toolbar',
                                title   : 'Full screen',
                                dock    : 'top',
                            }],
                            html        : 'Full!'
                        });
                        return false;
                    } else {
                        return true;
                    }
                }
            }
        }); 
    }
});

然后您必须以某种方式关闭该面板(可能是关闭按钮),以便用户可以返回到原始选项卡面板。不过,您最好保持选项卡面板不变,然后将新卡添加到选项卡面板内的面板中。

希望这能回答您的问题。

That's not really the point of a tab panel. It's supposed to load cards into the main panel and let you move between them. You could load a new fullscreen panel (which could have it's own tab panel or other elements) by intercepting the card switch and rendering your new separate panel like so:

new Ext.Application({
    name: 'Demo App',
    launch: function() {
        this.viewport = new Ext.TabPanel({
            fullscreen: true,
            id: 'mainPanel',
            cls: 'homescreen',
            items: [{
                title   : 'Home',
                html    : 'Welcome'
            },{
                title   : 'Full screen'
            }],
            listeners   : {
                beforecardswitch : function (ct, newcard, oldcard) {
                    if (newcard.title == 'Full screen') {
                        var panel = new Ext.Panel({
                            fullscreen  : true,
                            dockedItems : [{
                                xtype   : 'toolbar',
                                title   : 'Full screen',
                                dock    : 'top',
                            }],
                            html        : 'Full!'
                        });
                        return false;
                    } else {
                        return true;
                    }
                }
            }
        }); 
    }
});

You would then have to close that panel somehow (a close button probably) so the user could return to the original tab panel. Though you are better off leaving the tab panel as is and add new cards to panels within the tab panel.

Hope this answers your question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文