4 Replies Latest reply on Dec 1, 2015 1:28 PM by Malcolm

    Dynamic map displays in Preview mode?


      I have a webviewer in a layout that displays a map generated with Leaflet, an excellent lightweight dynamic map API. When I switch to Preview Mode the display disappears and doesn't re-render. Is there any way I can use dynamic maps in Preview (so that it appears on a report) or must I use static maps like Google (which I know works)?

        • 1. Re: Dynamic map displays in Preview mode?

          Web viewers should work in preview mode. Check the troubleshooting page to see if there is anything there that makes sense in your situation.

          • 2. Re: Dynamic map displays in Preview mode?

            Thanks for the suggestion but there is nothing there covering my issue. The web viewer loads an HTML file that contains JavaScript, loads the Leaflet libraries from the same directory and pulls in a JSON file of markers. This all works fine while the layout is in Browse mode but when the Preview button is clicked the page renders with a blank web viewer.


            I also have a version of the layout that uses a Google static map and that does render on switching to Preview.


            I assume that the web viewer reloads the HTML page on changing mode, but can't think why this would fail.



            • 3. Re: Dynamic map displays in Preview mode?

              I have worked out where the problem lies and worked around it, but not fathomed the reason for the behaviour:


              A 'SummaryReport' layout shows a list of locations and a web viewer displaying a Leaflet-based map with those locations as markers.


              The 'SummaryReport' layout  is opened from a popover-based menu that calls a script 'ReportWithMap'  that GTRRs to the layout in a new window and switches it to preview mode.

              Originally, the map generation script 'PrepareMap' was called by the SummaryReport's OnLayoutEnter trigger (this script generates JSON for the markers, inserts that into the HTML skeleton code, exports it to the temp directory, then sets the web viewer to use that path). This shows the map in browse mode but not in preview mode. I tried triggering from the SummaryReport layout's OnModeEnter trigger but this didn't work either.

              I moved the call to 'PrepareMap' into the 'ReportWithMap' script between the GTRR and Goto Preview Mode steps and the map is now rendered in Preview Mode (although it needs a short pause to allow the webviewer to load the map tiles).


              While this solves my problem, it doesn't explain why this was happening.


              Can anyone enlighten me?



              • 4. Re: Dynamic map displays in Preview mode?

                It sounds like your resources are being tidied up when you switch to

                preview mode. Have you tried to run the process while you are watching

                the temp folder? You may see something happening there that explains the