PDA

View Full Version : Problem with function setVisible



iNes14
21 Dec 2011, 5:44 AM
Hello, I want to hide/show a container which contains fieldset and comboBox when I choose a radio button. I do that :




var first = {
xtype: 'container',
layout: 'hbox',
margin: '0 0 10',
items: [{
xtype: 'fieldset',
flex: 1,
title: 'Choice',
height:150,
defaultType: 'radio',

items: [{
checked:true,
boxLabel: 'Root',
name: 'choice',
id:'root',
inputValue: 'root'
}, {
boxLabel: 'Participant',
name: 'choice',
id:'participant',
inputValue: 'participant',
handler: function() {
second.setVisible(true);
}
}]
}]
};

var second = {
xtype: 'container',
layout: 'hbox',
margin: '0 0 10',
hidden:true,
items: [{
xtype: 'fieldset',
height:300,
title: 'Selection',
defaultType:'combo',
items:[{
fieldLabel:'Field 1',
displayField: 'field1',
store:store1
},
{
fieldLabel:'Field 2',
displayField: 'fileld2',
store:store2
},
{
fieldLabel:'Field 3',
displayField: 'field3',
store:store3
},
{
fieldLabel:'Field 4',
displayField: 'field4',
store:store4
},
{
fieldLabel:'Field 5',
displayField: 'field5',
store:store4
},
{
fieldLabel:'Field 6',
displayField: 'field6',
store:store5
}]
}]
};





But it doesn't work, Firebug told me that 'second.getVisible is not a function'.

Thank for your help !

mitchellsimoens
21 Dec 2011, 8:39 AM
That's because second is an Object not a component. You need to resolve the actual instance.

iNes14
22 Dec 2011, 12:10 AM
Ok it's good, thank you I do that :



var second = Ext.create('Ext.container.Container', {
layout: {
type: 'hbox'
},


But now, the function setVisible(false) hide my container but the function setVisible(true) don't show other container. Do you know why ?