View Full Version : Targeting Links in Layouts
Urbanite
3 Aug 2007, 7:13 PM
I am new to extJS...and busy reading docs and tutorials ans such trying to get familiar with extJS.
I could really use a quick bump in the right direction. I have a working install of extJS, with a successfully integrated Accordian component. I am using the "Complexe" example Layout code for my testing purposes. The question is:
How do I direct clicks in one Div to target another? So, for instance, if I click a link on my "East" area, I want it to land in my "Center" area. Make sense? Any assistance would be greatly approciated.
jay@moduscreate.com
4 Aug 2007, 3:49 AM
you have to ad a click listener to those 'links'. When clicked, the event fires and executes a function that adds a content panel with an iframe, and loads the content. Hope this isn't too vague.
Urbanite
4 Aug 2007, 6:38 AM
Thanks so much for the reply. Maybe it would help for me to paste in what I am trying to use now. I keep getting various errors about undefined this and object doesn't support that.
The Layout is setup as such:
layout.beginUpdate();
layout.add('north', new Ext.ContentPanel('north', 'North'));
layout.add('south', new Ext.ContentPanel('south', {title: 'South', closable: true}));
layout.add('west', new Ext.ContentPanel('west', {title: 'West'}));
layout.add('east', new Ext.ContentPanel(Ext.id(), {autoCreate:true, title: 'Dynamic Tab', closable: true}));
layout.add('east', new Ext.ContentPanel('autoTabs', {title: 'Auto Tabs', closable: true}));
layout.add('center', new Ext.ContentPanel('center1', {title: 'Close Me', closable: true}));
layout.add('center', new Ext.ContentPanel('center2', {title: 'Center Panel', closable: false}));
layout.getRegion('center').showPanel('center1');
layout.getRegion('west').hide();
layout.endUpdate();
And the function I am using to update center1 is:
loadCenter1 : function(link){
var target = layout.getRegion('center');
target.setUrl(link);
}
Calling this function as such:
<a href="#" onClick="Bravura.loadCenter1('/intranet/calendar/index.php');return false;">
Bravura is just the app name BTW.
You don't set the URL for a region, you set the url for a content panel inside a region.
Urbanite
4 Aug 2007, 7:49 AM
That makes some sense. Been back for forth on it a couple of times with different mixes of syntax - so what I meant to paste was:
var target = layout.getRegion('center1');
When that change is made, I get the error "undefined is null or not an object". So, I am thinking that it is scoped wrong - but I don't know what syntax is appropriate for scoping it correctly at the panel level.
Can you give me a gentle push in the right direction on syntax?
As I said, you don't set the URL for a region, you set it for a particular content panel.
So you might do something like...
var params = {};
var center = myLayout.getRegion('center'); //i am the center region
var panel = center.getPanel(0); //i am the first content panel in center
panel.setUrl('blah', params); //set the url
Urbanite
4 Aug 2007, 8:23 AM
That worked! Thanks for helping a newbie!!
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.