-
12 Jul 2010 3:20 AM #1
Card Layout Activate Event
Card Layout Activate Event
Hello,
When the setActiveItem function is called in a panel layout implementation, is there an event fired to indicate the active item has changed?
I tried adding a listener for the activate event in my card panel config but it does not fire, I also tried listening for the panel's show event, see code below.
Clearly I am doing something wrong, can someone please assist or at least point where in the API docs I will find my answer?Code:id: 'centerRegion', xtype: 'panel', region: 'center', id: 'centerCardPanel', layout: 'card', activeItem: 0, items: [{ xtype: 'panel', id: 'pnlHome', title: 'Home Content.' },{ headerAsText: false, layout: 'border', items:[{ region: 'center', items:[_mapPanel] },{ title: 'Map Tools', region: 'east', width: 150, collapsible:true },{ title: 'Location Grid', region: 'south', height: 150, split: true, collapsible:true }], bbar: new Ext.Toolbar({ buttonAlign: 'center', items:[{ xtype: 'button', id: 'btnToggleMap', text: 'Show Map' },'-',{ xtype: 'button', id: 'btnZoomUnit', text: 'Zoom To Unit' },'-',{ xtype: 'button', id: 'btnUnitDetails', text: 'Unit Details', handler: function() { } } ], autoHeight: true, hideBorders: true }) }], listeners: { activate: function(panel) { alert('panel activated'); } }
Many Thanks,
Rob
-
12 Jul 2010 3:43 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
The 'activate' and 'deactivate' events are fired on the card layout items and not on the container with card layout itself.
-
12 Jul 2010 4:52 AM #3
Some problems looming with with that overnested layout with missing layout configs though!
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
12 Jul 2010 4:57 AM #4
Yeah I know, was just showing an extract of my code to assist with my question. Thanks
-
12 Jul 2010 6:31 AM #5
Hi Animal,
In regards to your last comment, I think I have indeed hit a problem but am unsure how I get around this (egg on my face!). At the moment I have a viewport with a center region defined as per my code below which as you can see contains a card layout. The second item of which I am tryng to define via another border layout so I can have two collapsible regions:
When navigating to this item in my card panel I get the layout as shown in my image attached. Although my nested center region collapses it does not cause the south region to expand and fill the available space as I would expect it to.Code:{ xtype: 'panel', region: 'center', id: 'centerCardPanel', layout: 'card', activeItem: 0, defaults: { listeners: { activate: function(panel) { this._setNavBarForCurrentPage(); }, scope: this } }, items: [{ xtype: 'panel', id: 'pnlHome', title: 'Home Content.' },{ id: 'pnlLocation', layout: 'border', items:[{ region: 'center', collapsible:true },{ region: 'south', collapsible:true, height:150 }], bbar: new Ext.Toolbar({ buttonAlign: 'center', items:[{ xtype: 'button', id: 'btnToggleMap', text: 'Show Map' },'-',{ xtype: 'button', id: 'btnZoomUnit', text: 'Zoom To Unit' },'-',{ xtype: 'button', id: 'btnUnitDetails', text: 'Unit Details', handler: function() { } } ], autoHeight: true, hideBorders: true }) }] }
The reason I am approaching this like so is that I wish to control the collapsed status of these regions whenever the user clicks on certain top menu items.
I hope this makes sense - what I am trying to do that is, I am sure I am doing something wrong in code here, just unsure what.
Thanks,
Rob
-
12 Jul 2010 7:59 AM #6
You cannot collapse a Panel in a border layout. You must ASK the border layout's region to collapse.
Code:myBorderLayoutContainer.layout.west.onCollapseClick();
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
12 Jul 2010 8:09 AM #7Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
Which Ext version are you using? Older Ext versions required that you configured the panels in a card layout that had layouts themselves (e.g. your border layout panel) with hideMode:'offsets'.
-
12 Jul 2010 8:14 AM #8
I am using 3.2.1
I am confused by being unable to collapse a panel in a border layout. If thats so, then how come my south region in my second card panel does collapse for me as expected?
Also, in my screen shot I have a west region in a border layout containing collapsible panels which also collapse and expand.
I cannot find a reference to this onCollapseClick function when looking in the API docs, although I see it in Firebug ok. I have looked in the BorderLayout.Region section in the latest version.
Cheers,
Rob
-
12 Jul 2010 10:17 AM #9
BorderLayout (And its helper classes, the Region managers) are VERY old code. From the yui-ext days. You will have to use these undocumented methods. It is a valid requirement to be able to manipulate the regions programatically through a documented API, but it's not there in this version.
They will need refactoring for them to be as usable and flexible as the modern layout classes like the Box layouts.
Ext 4 should bring a improvement.Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
Similar Threads
-
Ext.ux.layout.ArrowCard - Card Layout With Sidearrow buttons
By NeonMonk in forum Ext 2.x: User Extensions and PluginsReplies: 1Last Post: 14 Feb 2009, 7:34 AM -
activate event
By Silent79 in forum Ext 2.x: Help & DiscussionReplies: 12Last Post: 26 Nov 2007, 3:54 PM -
Activate and create event handler Tab Panel at Layout Dialog
By electric_bit in forum Ext 1.x: Help & DiscussionReplies: 3Last Post: 18 Dec 2006, 8:50 PM


Reply With Quote