Print Dijit works in sandbox but not in html...?

1369
13
03-26-2014 11:27 AM
ralphholmes
New Contributor III
Greetings All,

So I have been working on building a java script API map for some time now and I am at a point where I am trying to add in a print template. I have been working off of the samples provided and get the print drop down button to display and function as it should in my application when working in the ArcGIS API for java script sandbox...

However when I take the same code back into my HTML document and test it the button does not appear at all...

It also seems that if I take the sample codes provided into an html document and test them they produce the same effect. The print button does not display at all.

This is the only issue that I am having with my API at this time.

I can post code segments if needed but the print functionality is verbatim from sample provided from

https://developers.arcgis.com/javascript/jssamples/widget_print_esri_request.html

Thanks for your help with this issue.
0 Kudos
13 Replies
JonathanUihlein
Esri Regular Contributor
Hello and welcome to the forums!

It sounds like this may be a proxy issue. Have you followed the guide for setting up a valid proxy?
0 Kudos
JonathanUihlein
Esri Regular Contributor

According to the console, your syntax is wrong.

For example:

<script>om/3.11/esri/css/esri.css">
</style>

I recommend using tools like jshint and jslint combined with your browser's console and web-dev-tools to find these types of errors.

0 Kudos
ralphholmes
New Contributor III
I was not aware that a proxy service needed to be set up, can you link me to the walk-through please and i'll give it a try?
0 Kudos
JeffPace
MVP Alum
Also remember you cannot run html simply in the browser, it MUST be served up on a web server.
0 Kudos
ralphholmes
New Contributor III
the application that I am developing is currently being served through our website. Everything functions we just thought it would be nice to have an internal print button with print templates...

You may be right about the proxy thing  

I currently use 

esriConfig.defaults.io.proxyUrl = "/proxy";


Which is what the samples use, but I found another example this morning in stackOverflow that uses

esri.config.defaults.io.proxyUrl = "/arcgisserver/apis/javascript/proxy/proxy.ashx";


Which leads me to believe that the samples being shown in the resources have something setup and all calling it "/proxy"...
0 Kudos
JeffPace
MVP Alum
that path needs to be correct to a file in your application
0 Kudos
ralphholmes
New Contributor III
OK,

So...

I went and did my own digging through the forum ocean and fished out a few things.

Post about Proxy's here

to my understanding I need the proxy file because the rest server for my print service lives in a different server than the one that the map is being hosted on...?

I downloaded the Java proxy from GitHub and pointed
esriConfig.defaults.io.proxyUrl="";
at it and it still is not working.

The only thing that i can think of is the proxy file either is not configured properly or it is not in the correct directory. (the proxy file currently lives in a network drive in the same folder as the html page). Neither I nor the web designer in my office have ever used a proxy page before and the Readme file is a little confusing.

Any help would be appreciated
0 Kudos
JeffPace
MVP Alum
for a proxy at the same spot as the index.nthl, it should be

esri.config.defaults.io.proxyUrl = 'proxy.jsp';

or
esri.config.defaults.io.proxyUrl = 'proxy.php';


etc... based on which version you chose to use
0 Kudos
ralphholmes
New Contributor III
It looks like the web guy in the office is using PHP

I tried simply pointing the code at 'proxy.php' and no luck...
0 Kudos