Select to view content in your preferred language

Extend the esri JavaScript BasicViewer with additional buttons

4456
13
10-10-2013 05:15 AM
JoseSanchez
Frequent Contributor
Hi all,

I downloaded the JavaScript BasicViewer source code and I would like to add a few more buttons, for example the Home button, th Locator button, a select by rectangle button, a buffer button.


Is there any place that explains where and how to add additional buttons.

Thanks
0 Kudos
13 Replies
JonathanUihlein
Esri Regular Contributor
Anytime you see "dojo.something", it generally means that is non-AMD.

In the index file is the following code:

dojo.require("utilities.App");
dojo.require("templateConfig.commonConfig");
var i18n;
dojo.ready(function(){ ...


This indicates a non-AMD style application.

I am speaking with you, as an employee of ESRI, attempting to help 😃

http://www.esri.com/careers/students/summer-internships/intern-profiles/intern-profile-web-design-de...

You said you had the Basic Viewer in AMD style and I wanted to see your code, because the viewer you linked is in legacy style, so buttons are added in a different way (it matters).
0 Kudos
JoseSanchez
Frequent Contributor
Hi again,

I do not understand!! 

I downloaded the Basic Viewer generated from the template. Because some js files are AMD style I assumed that the whole project was AMD.

Does it mean that this code is legacy code and will not run soon?

Are we going to get a new version with pure AMD?

Going back to the topic of this post, could you please give me some samples of source code to add this type of buttons, panels, etc:

Toolbar with the following buttons:
o Previous Extent, Next Extent
o Select By Rectangle, By Polygon, by Circle,
o Buffer,
o Network Tracing (VERY IMPORTANT)
�?� Customize Base map toolbar, to show custom base maps instead of Esri base maps
�?� popup results window showing the selection of several features
o Layers list, add interactivity when check/uncheck layer maps refreshes. Currently I only get one layer per map service, can not check/uncheck layers inside a group
�?� Multi search floating panel, search by address, intersection, folio, etc,

Thanks


Anytime you see "dojo.something", it generally means that is non-AMD.

In the index file is the following code:

dojo.require("utilities.App");
dojo.require("templateConfig.commonConfig");
var i18n;
dojo.ready(function(){ ...


This indicates a non-AMD style application.

I am speaking with you, as an employee of ESRI, attempting to help 😃

http://www.esri.com/careers/students/summer-internships/intern-profiles/intern-profile-web-design-de...

You said you had the Basic Viewer in AMD style and I wanted to see your code, because the viewer you linked is in legacy style, so buttons are added in a different way (it matters).
0 Kudos
JonathanUihlein
Esri Regular Contributor
I'll do my best to help answer these questions (Sorry for derailing this thread BTW!!)

The widgets and AMD style scripts will continue to work when the ESRI JSAPI switches to using DOJO 2.0 (hooray!). This is a LONG time away and the time-frame mostly depends on when DOJO releases version 2.0 of their API. Speculation is that ESRI JSAPI Version 4.0 will use DOJO 2.0.

If you continue to use ESRI JSAPI Version 3.7 (or 3.8, 3.9, or previous versions), your application and the templates will continue to work as expected.

It's up to you to switch to AMD when it is most convenient for you. Although, it is not an over-night switch.

However, it is not a big deal if you don't switch to AMD right away. It takes some time to learn the basics and even longer to master the caveats and intricacies.

I assume there will be a new version with pure AMD, although that might be released closer to when the big 'required' switch to AMD is scheduled to occur (a year? more? It's hard to guess at this point).

Going back to the topic of this post, could you please give me some samples of source code to add this type of buttons, panels, etc:


Sure! Let me look at the code again and I'll get something together. Thanks for the great questions!
0 Kudos
JoseSanchez
Frequent Contributor
Jonathan,

I also have another question, could the Basic Viewer be added to the http://esri.github.io/#ActionScript,JavaScript

Several other developers are using this viewer as a starting point of their JavaScript developments.

Thanks
0 Kudos