View Full Version : Add 'Left' and 'Right' tolls to a Panel

7 Sep 2011, 10:09 AM

I'm using ExtJS 4 with a panel which I would like to expand and collapse (to the left and right respectively).
I've added a tool of type 'Left':

this.tools = [ {
type: 'left',
itemId: 'leftBtn',
handler: function(evt, toolEl, panel, tc) {


I would like to collapse the panel to the left when pressing the 'left' icon and than to expand it when pressing the 'right' button.
I'm not sure how to actually collapse and expand the panel.
How should I do that?

Thank you,

7 Sep 2011, 11:24 AM
Are you looking for the panel.collapse() method? Just look at the API docs!

7 Sep 2011, 8:56 PM
I have tried that but it doesn't work for me.
Debugging this, when clicking the 'left' button I see that panel is of type "Ext.panel.Header" and it doesn't have a 'collapse' method.

7 Sep 2011, 9:19 PM
I've managed to get the Panel component and used collapse() method as suggested.
Thank you