Select to view content in your preferred language

is it possible to specify my own template for esri.dijit.measurement?

617
2
04-30-2013 04:37 AM
ChrisJudd
New Contributor
I have a client that has a requirement for the measurement tools to be aligned a certain way and be labeled a certain way.  Since the esri.dijit.measurement dijit is wrapped tightly, my options feel very limited.  Is there a way that I could specify my own template, that would have all of the divs and labels that I need? 

Any help would be appreciated. 

-Chris
0 Kudos
2 Replies
BenFousek
Regular Contributor
It's time to write your own measurement widget.

http://dojotoolkit.org/documentation/tutorials/1.8/templated/

The esri widgets are fine with simple applications, but if you are going to develop applications with lots of features, tools, etc they start creating more problems than they solve.  Mostly because they are not very customizable, if at all, in the way they function and in styling.  This is inherent in templated widgets in general.  The js team does a good job of adding/updating base functionality in widgets to make them as functional for as many people as they can, but they can't take every possible situation into account.  If you need more than the widget offers, write your own.  That's the power of dojo.  I don't know what your experience is with dojo and templated widgets, but if you are new at it, it can be a little overwhelming at first.  But get a couple under your belt and a whole world of possibilities will open up for you when developing highly functional applications.  Perhaps not what you wanted to hear, but I hope it helps.

Cheers, Ben
0 Kudos
JianHuang
Occasional Contributor III
Chris,

You can modify the CSS to change the look and feel. Please see the CSS part at:
http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/measurement.html

Additionally, you can hide/show some parts of the template, add/remove items from the unit dropdown and customize other stuff. There are some things that don't support to customize. For example, it's not possible to move the result div from bottom to top. As Ben pointed out, it's defined in the dijit template. Maybe you can clarify what you need so that we can discuss the possibility.

I have a client that has a requirement for the measurement tools to be aligned a certain way and be labeled a certain way.  Since the esri.dijit.measurement dijit is wrapped tightly, my options feel very limited.  Is there a way that I could specify my own template, that would have all of the divs and labels that I need? 

Any help would be appreciated. 

-Chris
0 Kudos