'EXTJS: hidden element does not show up after setvisible

Hello I want to show and image that is like an alert sign when a change is done, then I have a footer panel like this one, with the sign:

Ext.define('footerPanel', {
    extend: 'Ext.panel.Panel',
    cls: 'fastec_background',
    height: 24,
    autoScroll: false,
    border: false,
    layout: {
        type: 'border'
    },
    id: 'panel_footerFastec',


    initComponent: function () {
        var me = this;


        Ext.applyIf(me, {
            items: [{
                margin: '5 5 0 20',
                xtype: 'label',
                region: 'center',
                html: '<a>© 2012 FASTEC GmbH, Paderborn, Germany - </a><a target="_blank" href="http://www.easyoee.de">www.easyOEE.de</a> <a target="_blank" href="http://www.fastec.de">www.fastec.de</a>'
            }, {
                xtype: 'container',
                region: 'east',
                layout: 'table',
                id: 'cont_footer_icons',
                items: [{
                    xtype: 'image',
                    id: 'configchangedIcon',
                    height: 16,
                    margin: '5 0 5 0',
                    width: 16,
                    maxHeight: 20,
                    dock: 'right',
                    maxWidth: 20,
                    scale: 'large',
                    src: 'files/images/disk_blue.png',
                    hidden: true
                }, {
                    xtype: 'image',
                    height: 16,
                    id: 'errorIcon',
                    margin: '5 0 5 0',
                    width: 16,
                    dock: 'right',
                    maxHeight: 20,
                    maxWidth: 20,
                    scale: 'large',
                    src: 'files/images/error16.gif',
                    hidden: true
                }]
            }]
        });


        me.callParent(arguments);
    }
});

And the idea is that I have a general function which I could call anywhere and show or hide the icon, but unfortunately I call this function and nothing happens:

changeIconVisibility = function(str, value) {
    try {
        switch(str){
            case 'configchangedIcon':
                var img = Ext.getCmp('configchangedIcon');
                if(value){
                    img.setVisible(true);
                }else{
                    img.setVisible(false);
                }
            break;
        }
    } catch (e) {
        Ext.msg.alert(e);
    }
}

I tried by directly calling the component and setVisible(true) as well and nothing happens.



Solution 1:[1]

get the footerPanel component and use hide/ show method.

like

var myPanel = Ext.getCmp('your_panel');
myPanel.items.items[1].hide() //second  item

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.panel.Panel-method-hide

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.panel.Panel-method-show

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jom