Table of Contents (TOC)/Legend Widget JavaScriptAPI doesn´t working in a HTML Frameset

3327
3
09-15-2015 05:35 AM
KrischtaHett
New Contributor

Hi, I create an application with Javascript API. I used the Table of Contents (TOC)/Legend Widget for switching layers

and first it worked. After I built an HTML Frameset and also put the TOC in one Frame it doesn´t work anymore. But all other elements of my map are displayed.

I get this error: TypeError: a is null... /3.14/ (Zeile 143, Spalte 272)

Can someone help me?

0 Kudos
3 Replies
MichaelVolz
Esteemed Contributor

Here is a link to a popular 3rd party TOC widget

http://www.arcgis.com/home/item.html?id=9b6280a6bfb0430f8d1ebc969276b109

This might be easier than developing your own TOC

KrischtaHett
New Contributor

Hi,

thank you but I´m sorry for not beeing fully clear in the first place but I already used that tool.

When I put the "tocdiv" in one frame and the "map" in another frame of the <body> the "tocdiv" is not working. It only works together.

I would like to have a frame with the map and one frame with the legend (toc).

Is there any resolution?

0 Kudos
TyroneBiggums
Occasional Contributor III

Yes, don't use frames. They are probably messing with the scope of your objects because one object is on one html page, and the other object is in another html page. Consider using something else for your containers.

It's not so much the frames causing the issue but the difference sources being out of scope from each other. You might can get away with using frames if both frame sources are referencing the same global javascript object (file). But anything that you change in source1 will not be known in source2. You'd also have to maintain data in your global object.

There is a dojo layout that you could utilize if you don't want to write your own. Also look into a single page application along with a dojo layout. The concept here is that all of your code will render on the same page (it can affect performance if you're no careful).