PDA

View Full Version : Collapse element on click?



Kadifo
9 Aug 2010, 6:18 AM
Hi,

I'm a ExtJS newbie, so please help me through this as I can't do it myself. I simply got this element:



region: 'south',
id: 'south-panel', // see Ext.getCmp() below
title: 'Fragt',
split: true,
width: 200,
height: 350,
maxHeight: 350,
minHeight: 350,
collapsible: true,
resizable: false,
margins: '0 0 0 5',
contentEl: 'west'


I would like to make a JS function that can collapse open/close this onclick? Is this possible, I've tryed Google but got lost after 30 minutes :s

Condor
9 Aug 2010, 6:29 AM
Doesn't the example from which you copied this already do this?

It would be something like:

Ext.get('my-link').on('click', function(){
Ext.getCmp('south-panel').collapse();
}, null, {stopEvent: true});

Kadifo
13 Aug 2010, 4:53 AM
It was just the:
Ext.getCmp('south-panel').collapse();
Ext.getCmp('south-panel').expand();
That I needed!

Thanks !! :D

Perhaps you also got the code that decides if the panel will be expanded or not whenever the script loads? :)