Sencha Touch:Tabpanel 内的 ext.List 有问题吗?

发布于 2024-11-30 05:39:32 字数 2426 浏览 1 评论 0原文

学习 Sencha Touch,并且已经爱上它了。我认为比 JQTouch 好得多。只是在研究我的一些应用程序想法,我需要有 2 个选项卡,其中第一个选项卡将保存带有一些数据的 ext.List 。我已经走到这一步了,但有一个问题我无法解决。

问题:当我触摸列表中的名称时,详细信息面板不会显示。当它不在选项卡面板中时,我完全没有任何问题。论坛都试过了,没找到解决办法。

这是我的整个代码(基于许多示例):

ShotjesApp = new Ext.Application({
name: "Shotjes",
launch: function() {

    ShotjesApp.detailPanel = new Ext.Panel({
        id: 'detailpanel',
        tpl: 'Omschrijving: {Naam} <br> <br> {Inhoud}',
        dockedItems: [
            {
                xtype: 'toolbar',
                items: [{
                    text: 'terug',
                    ui: 'back',     
                    handler: function() {
                    ShotjesApp.Viewport.setActiveItem('listwrapper', {type:'slide', direction:'right'});
                    }
                }]
            }
        ]
    });

    ShotjesApp.listPanel = new Ext.List({
        id: 'disclosurelist',
        store: ListStore,
        itemTpl: '<div class="contact">{Naam} {Basis}</div>',
        grouped: true,
        onItemDisclosure: function(record, btn, index) {
    var naam = record.data.Naam;
            ShotjesApp.detailPanel.update(record.data);
            ShotjesApp.Viewport.setActiveItem('detailpanel') //THIS WON'T WORK?
    ShotjesApp.detailPanel.dockedItems.items[0].setTitle(naam);
        }
    });

    ShotjesApp.listWrapper = new Ext.Panel ({
        id: 'listwrapper',
        layout: 'fit',
        items: [ShotjesApp.listPanel],
        dockedItems: [
                    {
                    dock : 'top',
                    xtype: 'toolbar',
                    title: 'Shotjes'

    }],

                });

this.mainView = new Ext.TabPanel({ 
    tabBar: { 
            dock: 'bottom', 
            ui: 'dark', 
            layout: { pack: 'center' } 
        }, 
    cardSwitchAnimation: { 
            type: 'fade', 
            cover: true 
        },  

    items:[{
title: 'Shotjes', 
        cls: 'card 1', 
        id: 'card 1', 
        items: [ShotjesApp.listWrapper, ShotjesApp.detailPanel] ,
        iconCls: 'home', 
        layout: 'card', 

    }, {
        title: 'About', 
        cls: 'card 2', 
        id: 'card 2', 
        html: 'about',
        iconCls: 'calendar', 
        layout: 'card', 
    }


    ],

    tabBarDock: 'bottom', 
    fullscreen: true, 
    layout: 'fit' 
}); 

this.Viewport = this.mainView; 
} 

});

Learning Sencha Touch, and already love it. Much better then JQTouch in my opinion. Just working on some app idea I had, and I need to have 2 tabs where the first tab will hold a ext.List with some data. I've come this far, but have one problem I can't figure out.

Problem: The detailpanel won't show when I touch a name from the list. When it wasn't in a tab panel, I had no problems at all. Tried the forums, can't find the solution.

This is my entire code (based upon many examples):

ShotjesApp = new Ext.Application({
name: "Shotjes",
launch: function() {

    ShotjesApp.detailPanel = new Ext.Panel({
        id: 'detailpanel',
        tpl: 'Omschrijving: {Naam} <br> <br> {Inhoud}',
        dockedItems: [
            {
                xtype: 'toolbar',
                items: [{
                    text: 'terug',
                    ui: 'back',     
                    handler: function() {
                    ShotjesApp.Viewport.setActiveItem('listwrapper', {type:'slide', direction:'right'});
                    }
                }]
            }
        ]
    });

    ShotjesApp.listPanel = new Ext.List({
        id: 'disclosurelist',
        store: ListStore,
        itemTpl: '<div class="contact">{Naam} {Basis}</div>',
        grouped: true,
        onItemDisclosure: function(record, btn, index) {
    var naam = record.data.Naam;
            ShotjesApp.detailPanel.update(record.data);
            ShotjesApp.Viewport.setActiveItem('detailpanel') //THIS WON'T WORK?
    ShotjesApp.detailPanel.dockedItems.items[0].setTitle(naam);
        }
    });

    ShotjesApp.listWrapper = new Ext.Panel ({
        id: 'listwrapper',
        layout: 'fit',
        items: [ShotjesApp.listPanel],
        dockedItems: [
                    {
                    dock : 'top',
                    xtype: 'toolbar',
                    title: 'Shotjes'

    }],

                });

this.mainView = new Ext.TabPanel({ 
    tabBar: { 
            dock: 'bottom', 
            ui: 'dark', 
            layout: { pack: 'center' } 
        }, 
    cardSwitchAnimation: { 
            type: 'fade', 
            cover: true 
        },  

    items:[{
title: 'Shotjes', 
        cls: 'card 1', 
        id: 'card 1', 
        items: [ShotjesApp.listWrapper, ShotjesApp.detailPanel] ,
        iconCls: 'home', 
        layout: 'card', 

    }, {
        title: 'About', 
        cls: 'card 2', 
        id: 'card 2', 
        html: 'about',
        iconCls: 'calendar', 
        layout: 'card', 
    }


    ],

    tabBarDock: 'bottom', 
    fullscreen: true, 
    layout: 'fit' 
}); 

this.Viewport = this.mainView; 
} 

});

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

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

发布评论

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

评论(2

美羊羊 2024-12-07 05:39:32

试试这个

ShotjesApp.Viewport.setActiveItem(ShotjesApp.detailPanel);

另外在您的代码中缺少分号。

try this

ShotjesApp.Viewport.setActiveItem(ShotjesApp.detailPanel);

Also in your code the semicolon is missing.

花想c 2024-12-07 05:39:32

酷,谢谢。我还添加了这一点,否则幻灯片将作为新选项卡打开:

    ShotjesApp.Viewport = new Ext.Panel ({
        fullscreen: true,
        layout: 'card',
        cardSwitchAnimation: 'slide',
        items: [ShotjesApp.listWrapper, ShotjesApp.detailPanel]
    });

与您的更改相结合,它完美地工作..

但这是一个巨大的问题。因为视口是全屏,所以当我按下第二个选项卡时,它不会显示。当我将第二个选项卡设置为 Fullscreen: true 时,我看到了动画,但第一个选项卡仍在其之上。

当我在视口中更改 fullscreen: false 时,老问题又回来了,详细信息窗格将不会显示。

Cool, thanks. I also added this, otherwise the slide would open as a new tab:

    ShotjesApp.Viewport = new Ext.Panel ({
        fullscreen: true,
        layout: 'card',
        cardSwitchAnimation: 'slide',
        items: [ShotjesApp.listWrapper, ShotjesApp.detailPanel]
    });

Combined with your change, it works perfectly..

One huge problem though. Because the Viewport is Fullscreen, The second tab won't show when I press it. When I set the second tab to Fullscreen: true, I see the animation, but first tab is still on top of it.

When I change fullscreen: false in the Viewport, the old problem comes back and the details pane won't show.

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