0
votes

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

});

2

2 Answers

0
votes

try this

ShotjesApp.Viewport.setActiveItem(ShotjesApp.detailPanel);

Also in your code the semicolon is missing.

0
votes

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.