1. #1
    Touch Premium Member
    Join Date
    Jan 2011
    Location
    Sydney, Australia
    Posts
    25
    Vote Rating
    0
    Frances is on a distinguished road

      0  

    Default load new panel on carousel click

    load new panel on carousel click


    Hi all

    Looking at a carousel which loads its item contents from a store, eg, Carousel 2 in the sencha examples (code attached for reference), I cannot figure out how to add an event so that when you click on the carousel active item, it loads a new panel with more details from that store record.

    There's a simple example in this forum of how to load an overlay when tapping on the carousel, http://www.sencha.com/forum/showthre...=carousel+link

    But I can't work out how to get the data from that record within that overlay.

    Any clues very much appreciated !

    Carousel 2 :
    Code:
    Ext.setup({
        tabletStartupScreen: 'tablet_startup.png',
        phoneStartupScreen: 'phone_startup.png',
        icon: 'icon.png',
        glossOnIcon: false,
        onReady: function() {
            Ext.getBody().mask('Loading...', 'x-mask-loading', false);
            var panel = new Ext.Panel({
                fullscreen: true,
                layout: 'fit',
                dockedItems: [{
                    xtype: 'toolbar',
                    dock: 'top',
                    items: [{
                        text: 'First card',
                        handler: function(){
                            var carousel = panel.getComponent('carousel'); 
                            carousel.setActiveItem(0, 'fade');
                        }
                    },{
                        text: 'Last Card',
                        handler: function(){
                            var carousel = panel.getComponent('carousel');
                            carousel.setActiveItem(carousel.items.getCount() - 1, 'fade');
                        }
                    }]
                }]
            });
            
            Ext.regModel('Card', {
                fields: ['content', 'cls']    
            });
            
            var store = new Ext.data.Store({
                model: 'Card',
                proxy: {
                    type: 'ajax',
                    url: 'data.xml',
                    reader: {
                        type: 'xml',
                        record: 'card'
                    }
                },
                listeners: {
                    single: true,
                    datachanged: function(){
                        Ext.getBody().unmask();
                        var items = [];
                        
                        store.each(function(rec){
                            items.push({
                                html: rec.get('content'),
                                cls: 'card ' + rec.get('cls')
                            });
                        });
                        
                        var carousel = new Ext.Carousel({
                            items: items,
                            itemId: 'carousel'
                        });
                        panel.add(carousel);
                        panel.doLayout();
                    }
                }    
            });
            store.read();
        }
    });

  2. #2
    Sencha User
    Join Date
    Apr 2008
    Location
    Portugal
    Posts
    8
    Vote Rating
    -1
    zeristoff is an unknown quantity at this point

      0  

    Default


    Anyone? I would like to know it too.

Similar Threads

  1. load carousel panel items dynamically??
    By algae in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 19 Aug 2010, 12:16 AM
  2. How to load url in another Grid Panel when click on submit button
    By Ajithamani in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 14 Dec 2009, 10:55 PM
  3. load xtemplate in a panel on a click
    By fongus in forum Ext 2.x: Help & Discussion
    Replies: 17
    Last Post: 14 Aug 2009, 12:27 AM
  4. Help needed : load a frame on a panel click
    By Androrion in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 7 Mar 2008, 2:52 AM
  5. Load panel on tab click or panel focus
    By kenITR in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 8 Nov 2007, 10:05 AM

Thread Participants: 1