Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User gcallaghan's Avatar
    Join Date
    Apr 2010
    Location
    Cupertino, Ca
    Posts
    247
    Vote Rating
    0
    gcallaghan is on a distinguished road

      0  

    Default [FIXED-296] panel.getLayout() returns string, not object

    [FIXED-296] panel.getLayout() returns string, not object


    Sencha Touch version tested:
    • 0.9 rev __4__
    • only default ext-all.css
    • custom css (include details)



    Platform tested against:
    • google chrome desktop

    Description:
    • when calling getLayout on a panel instance, the return value is a string, not a layout object

    Test Case:

    Code:
        /**
     * @author gcallaghan
     */
    var MEDIA_URL = '/media/';
    var HeaderBar = Ext.extend( Ext.Panel, {
        constructor: function(config) {
            var options = {
                leftButton:new Ext.Button({
                     text:"Back",
                     //hidden:true,
                     ui:"back",
                     handler:function(){
                        alert('Back');
                    }
                }),
                rightButton:new Ext.Button({
                     text:"Edit",
                     ui:"action" 
                })
            };
            
            
            Ext.apply(options, config);
            
            var obj = this; 
            obj.ad_bar = new Ext.Panel({
                layout: 'card',
                activeItem:0,
                items:[
                   {html:'<div class="ad"><img src="' + MEDIA_URL + 'img/iFinancials_Logo_44x960_whitefill.png" width="960px" height="44px" /></div>'},
                   {html:'<div class="ad"><img src="' + MEDIA_URL + 'img/ads_dummy/ad_appliance.png" width="320px" height="44px" /></div>'},
                   {html:'<div class="ad"><img src="' + MEDIA_URL + 'img/ads_dummy/ad_doors.png" width="320px" height="44px" /></div>'},
                   {html:'<div class="ad"><img src="' + MEDIA_URL + 'img/ads_dummy/ad_homedepotlogo.png" width="320px" height="44px" /></div>'},
                   {html:'<div class="ad"><img src="' + MEDIA_URL + 'img/ads_dummy/ad_refrigerators.png" width="320px" height="44px" /></div>'},
                ],
                minHeight:44,
                cls:'ad-bar'
            });
            
            obj.buttons = [options.leftButton,options.rightButton];
            obj.toolbar_default_items = [
               obj.buttons[0],
               {xtype: 'spacer'},
               obj.buttons[1]
            ];
            obj.toolbar = new Ext.Toolbar({
                hidden:false,
                title:"iFinancials",
                items:obj.toolbar_default_items,
                maxHeight:44
            });
            obj.valid_sides=['left', 'right',];
            var options = {
                    items:[obj.ad_bar,obj.toolbar],
                    dock:"top"
            };
            HeaderBar.superclass.constructor.call(this, options);
            this.rotateAds();
        },
        rotateAds:function(){
            var obj = this;
            var delay = 2000;
            var duration = 1250;
            var next = function(){
                var l = obj.ad_bar.getLayout(); // !!! FIXME this is returning a string not a layout object
                l.next({type:'flip', duration:duration}, true);
                setTimeout(timed_next,delay);
            }
            var timed_next = function(){setTimeout(next,delay);}
            timed_next();
        },
        setTitle:function(title){
            this.toolbar.setTitle(title);
        },
        toggleToolbar:function(){
            if (this.toolbar.isVisible()){
                this.toolbar.hide();
            }
            else {this.toolbar.show();}
            
            this.toolbar.doComponentLayout();
            this.doComponentLayout();
        },
        setDefaultToolbarHandler:function(func){
            this.toolbar.items.get(0).setHandler(func);
        },
        replaceButton:function(side, new_button){
            
            if (this.valid_sides.indexOf(side) >=0){
                var old;
                if(side == this.valid_sides[0]){
                    old = this.toolbar.items.get(0);
                    this.toolbar.remove(old, false);
                    this.toolbar.insert(0,new_button);
                }
                else {
                    old = this.toolbar.items.get(2);
                    
                    this.toolbar.remove(old, false);
                    this.toolbar.insert(2,new_button);
                }
                old.hide();
                new_button.show();
                this.toolbar.doComponentLayout();
                this.doComponentLayout();
            }
            
            //this.toolbar.doComponentLayout();
        },
        hideButton:function (side){
            if (this.valid_sides.indexOf(side) >=0){
                if(side == this.valid_sides[0]){
                    this.toolbar.items.get(0).hide();
                } else {
                    this.toolbar.items.get(2).hide();
                }
            }
        },
        resetToolBar:function(){
            for(var i = 0; i < this.valid_sides.length;i++){
                this.resetButton(this.valid_sides[i]);
            }
            this.toolbar.doComponentLayout();
            
        },
        resetButton:function(side){
            var button;
            if (this.valid_sides.indexOf(side) >=0){
                if(side == this.valid_sides[0]){button = this.buttons[0];}
                else {button = this.buttons[1];}
            }
            this.replaceButton(side,button);
            //this.toolbar.doComponentLayout();
        }
    });
    
    
    
    var headerbar = new HeaderBar({});
    var tabpanel = new Ext.TabPanel({
        dockedItems: [
            headerbar
        ],
        items:[
            {
                xtype:'button',
                text:"Back",
                ui:"back",
                handler:function(){
                    headerbar.replaceButton('left', new Ext.Button({text:'Hello'}));
                }
            },
            {
                xtype:'button',
                text:"Back",
                ui:"back",
                handler:function(){
                    headerbar.replaceButton('right', new Ext.Button({text:'Hello'}));
                }
            }
        ]
    });
    See this URL : http://


    Steps to reproduce the problem:
    • open in browser
    • use a javascript debugger to view the value of varl at line 65

    The result that was expected:
    • object ...

    The result that occurs instead:
    • 'card' ...

    Screenshot or Video:
    • attached

    Debugging already done:
    • none

    Possible fix:
    • not provided
    Last edited by gcallaghan; 13 Sep 2010 at 8:52 AM. Reason: copy paste error

  2. #2
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    20
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    Thank you for the report.

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    10
    TommyMaintz will become famous soon enough TommyMaintz will become famous soon enough

      0  

    Default


    In the next release (RC1) getLayout will always return an instantiated layout.

Similar Threads

  1. Replies: 6
    Last Post: 27 Aug 2012, 9:19 PM
  2. Replies: 1
    Last Post: 10 Aug 2010, 3:10 PM
  3. Replies: 0
    Last Post: 5 Aug 2010, 3:47 AM
  4. Replies: 1
    Last Post: 7 Apr 2010, 9:58 PM
  5. Replies: 2
    Last Post: 30 Jul 2009, 8:08 AM

Thread Participants: 2