Hi Rudy,
Thanks for your reply.
If I put printButton outside of the map container, then the click button works. But there are some other problems.
Since the layer is dynamically generated on a server, so I set
esri.config.defaults.io.proxyUrl = "mapping";
esri.config.defaults.io.alwaysUseProxy = true;
in the very beginning of init().
When we try to print the map, we need bypass this proxy server, otherwise the application cannot find mapping\http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%2...
which prefixes the printUrl with mapping\.
To bypass the proxy server, I set
esri.config.defaults.io.alwaysUseProxy = false
in the printMap() function. Now the print url is correct, but run into another problem, I cannot see the map any more. I guess it's because ESRI map is asynchronous. But how to arrange events happen one by one?
Thanks,
Ryan