Vishful thinking…

Working with the ESRI JS API and Dojo

Posted in Uncategorized by viswaug on August 25, 2008

I am starting to work on a project using ArcGIS 9.3 JS API (v1.1) and am beginning to feel my way around the Dojo javascript library. The first thing that jumps out at you when using Dojo is the lack of good documentation. Even some of their demos seem to broken. After using working with ExtJS for a little while before, the Dojo documentation and its features is definitely not impressive.

I began using the Layout Container for the page layout. I wanted the bottom panel in the layout to be collapsible so that the user cam maximize their map area when the bottom panel is not being used. The Title Pane in Dojo provides the collapsible panel functionality. But the Layout Container and the Title Pane have their own dojoType that needs to be applied to the DIVs and I haven’t found any documentation on how to apply the functionality of two dojoTypes to a single DIV. This functionality was a breeze to implement in ExtJS. So, I am starting to implement that functionality on my own.

That said, I was able to get the sample for the Layout Container up and running without problems. But the trouble began when I replaced the script include for Dojo with the script include for the ESRI JS API. The Layout Container did not work as expected after.

Replacing

<script type=”text/javascript” src=http://o.aolcdn.com/dojo/1.0/dojo/dojo.xd.js djConfig=”parseOnLoad: true”></script>

with

<script type=”text/javascript” src=”http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.1″></script>

causes the Layout Container to break. So, In included the parseOnLoad attribute with the ESRI JS script include like here

<script type=”text/javascript” src=”http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.1″ djConfig=”parseOnLoad: true”></script>

But didn’t solve my problem either. After a lot of head scratching and help from a colleague with trying out various permutations and combinations of things, I found that the following works.

<script type=”text/javascript”>djConfig = { parseOnLoad: true }</script>
<script type=”text/javascript” src=”http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.1″></script>

Advertisement