Select to view content in your preferred language

ExtJS  Layout problems  Legend?

1518
3
07-13-2012 08:09 AM
AndrewDavis
New Contributor
Hello, I have gotten a copy of the ExtJS Layout to work on my local machine.

I have the map showing/centered and behaving nicely.  I am working on putting legend information into the "west" panel and having a bit of frustration.

The example: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/framework_extj...
I have looked at this for a while and it appears that I should be able to set a property of "contentEl:" to a section of html in the page to "West" or something like that and then get access to placing content inside the "west" panel.

I have tried to set the html property to ..  html: "<div id='legend'></div>" or other things with no luck.

Does the panel actually talk/interact with other portions of the page or is there a thing I have missed.

my page is directly lifted from the samples.

Andy..


var viewport = new Ext.Viewport({
          layout: "fit",
          title: "EXT JS Layout",
          items: [{
            layout: "border",
            items: [{
              region: "center",
              title: "center",
              html: "<div id='map' style='height:100%; width:100%;z-index=: 1000;'></div>"
            }, {
              region: "north",
              height: 50,
              collapsible: false,
              contentEl:"header" 
            }, {
              region: "south",
              height: 80,
              collapsible: false,
              contentEl: "footer" // this gets the content from the div named "footer"
            }, {
              region: "west",
              title: "Left Panel",
              width: 150,
              split: true,
              collapsible: true,
              html: "Left panel content. This panel is collapsible and can be resized using the splitter",
              listeners:{
                collapse: resizeMap,
                expand: resizeMap
              }
            }, {
0 Kudos
3 Replies
KellyHutchins
Esri Frequent Contributor
Andy,

Here's one way you can add a legend to the left panel.
First add a div that will hold the legend to the 'west' region:
            region: "west",
              title: "Left Panel",
              width: 150,
              split: true,
              collapsible: true,
              html: "<div id='legend'></div>",
              listeners:{
                collapse: resizeMap,
                expand: resizeMap
              }


Then when you create the legend specify the id of the div:

          var legendDijit = new esri.dijit.Legend({
              map:map
            },"legend");
          legendDijit.startup();  

0 Kudos
AndrewDavis
New Contributor
Hey Kelly,

Thanks, I got it working,  youre right but theres something else.  The line about "spliter being true" needs to be either commented out or removed.

The ExtJS documentation stated that if you have a title on the region then you do not use the splitter.

I found that out after about 2 hrs of searching

Andy
0 Kudos
AndrewDavis
New Contributor
Hi there folks,
Sheepishly, I want to revise my remarks..  if you see the "contentEl: 'your<div>Here'" in the above code..  Well, that kind of looked like "contentE1" instead of a lower case L to me.

That was the only problem in my efforts.

Thanks again to Kelly..

Andy

Hey Kelly,

Thanks, I got it working, youre right but theres something else. The line about "spliter being true" needs to be either commented out or removed.

The ExtJS documentation stated that if you have a title on the region then you do not use the splitter.

I found that out after about 2 hrs of searching

Andy
0 Kudos