1. #1
    Sencha User
    Join Date
    Feb 2012
    Location
    Ireland
    Posts
    6
    Vote Rating
    0
    Gaelmart is on a distinguished road

      0  

    Default Overriding & dynamic items in config

    Overriding & dynamic items in config


    Hi
    This should be simple & common task I think but I'm on learning curve.

    There is a lovely image zoom control below which I can work outside of SA but I need to...

    Dynamically change the images (items) & number of.

    I've got the data worked out, meaning I know how to show database stuff in a LIST control. Not sure how to loop/add items: [ .... xtype: 'imageviewer',..... ]

    http://www.sencha.com/forum/showthre...ing-fine/page4

    SA FILE:
    --------------------------------------------------------------------
    Code:
    Ext.define('BoilerShop.view.DiagramCarousel', {
        extend: 'Ext.carousel.Carousel',
        alias: 'widget.diagramcarousel',
    
    
        config: {
            listeners: [
                {
                    fn: 'onCarouselActiveItemChange',
                    event: 'activeitemchange'
                },
                {
                    fn: 'onCarouselResize',
                    event: 'resize'
                }
            ]
        },
    
    
        onCarouselActiveItemChange: function(container, value, oldValue, options) {
            if(oldValue){
                oldValue.resetZoom();
                this.getActiveItem().resize();
            }
    
    
        },
    
    
        onCarouselResize: function(component, options) {
            this.getActiveItem().resize();
        }
    
    
    });


    Override file
    -------------------------------------
    Code:
    Ext.define('BoilerShop.OverrideDiagramCarousel', {
     override: 'BoilerShop.view.DiagramCarousel',
      
     
        config: {
            
              items: [
                        {
                            xtype: 'imageviewer',
                            style: {
                                backgroundColor: '#222'
                            },
                            imageSrc: 'http://www.ibasis.co.uk/Uploads/SAUNIER DUVAL/1281301.png'
                        },
                        {
                            xtype: 'imageviewer',
                            style: {
                                backgroundColor: '#222'
                            },
                            imageSrc: 'http://www.ibasis.co.uk/Uploads/SAUNIER DUVAL/1281302.png'
                        },
                        {
                            xtype: 'imageviewer',
                            style: {
                                backgroundColor: '#222'
                            },
                            imageSrc: 'http://www.ibasis.co.uk/Uploads/SAUNIER DUVAL/1281303.png'
                        },
                         {
                            xtype: 'imageviewer',
                            style: {
                                backgroundColor: '#222'
                            },
                            imageSrc: 'http://www.ibasis.co.uk/Uploads/SAUNIER DUVAL/1281304.png'
                        },
                         {
                            xtype: 'imageviewer',
                            style: {
                                backgroundColor: '#222'
                            },
                            imageSrc: 'http://www.ibasis.co.uk/Uploads/SAUNIER DUVAL/1281305.png'
                        }
                        
                    ]
     
      },
      constructor: function (config) {
             this.callParent(arguments); // calls Ext.tip.ToolTip's constructor
            alert('This gets shown so were ok here');
         }
         
    });

    Thanks

    Gary
    Last edited by aconran; 21 May 2012 at 10:34 AM. Reason: add code tags

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    8,185
    Vote Rating
    63
    aconran is just really nice aconran is just really nice aconran is just really nice aconran is just really nice aconran is just really nice

      0  

    Default


    Not sure I understand the question...
    Aaron Conran
    @aconran
    Sencha Architect Development Team