Zum Hauptinhalt gehen

GeoProcessing or PrintTask example using Quickstart?

Kommentare

5 Kommentare

  • Permanently deleted user

    Hi Ryan, do you mind posting the code that is failing, e.g. the line with "new"?

    0
  • Kevin Penner

    Hi Ryan,

    You'll likely need to require the correct modules. Since the Esri library is AMD, you need to ask for the 'pieces' you want to use and load them as needed. This way, the whole library isn't loaded which could bog down loadtimes.

    See the require at https://developers.arcgis.com/javascript/jsapi/printtask-amd.html

    -Kevin

    0
  • Permanently deleted user

    So... how would the 'require' look in the mvvm setting of the quickstart (which file / or if in ViewModel, can i declare for the whole 'class')...

    For example if i have my files:

    TemplateModule.css

     

    TemplateModule.ts

    TemplateModuleView.html

    TemplateModuleView.ts

    TemplateModuleViewModel.ts

    In TemplateModuleViewModel.ts for this dumbed down example the constructor gives the error "Error in Template moduleTypeError: Object doesn't support this action "

     

    /// <reference path="../../../Libs/Framework.d.ts" />

     

    /// <reference path="../../../Libs/Mapping.Infrastructure.d.ts" />

     

    /// <reference path="../../../Libs/jsapi_v311.js.d.ts"/>

     

    module quickStart.template {

     

        export class TemplateModuleViewModel extends geocortex.framework.ui.ViewModelBase {

     

            app: geocortex.essentialsHtmlViewer.ViewerApplication;

     

            greeting: Observable<string> = new Observable<string>();

     

            printTask: any = null;

     

            constructor(app: geocortex.essentialsHtmlViewer.ViewerApplication, lib: string) {

     

                super(app, lib);

     

            }

     

            initialize(config: any): void {

     

                try {

     

                    if (config) {

     

                        this.greeting.set(config["greeting"] || this.app.getResource(this.libraryId, "hello-world-greeting"));

     

                    }

     

                    

     

                var printURL = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task";

     

                this.app.trace.info("before print constructor");

     

                this.printTask = new esri.tasks.PrintTask(printURL, { async: true });

     

                this.app.trace.info("after print constructor");

     

                } catch (err) {

     

                    this.app.trace.error("Error in Template module" + err.toString());

     

                }

     

            }

     

        }

     

    }

     

     

     

    0
  • Kevin Penner

    Hi Ryan,

    You could use a legacy dojo.declare and add it to index.html (this is where the product puts the requires). In the upcoming release of 2.4 the index.html will include a dojo.require("esri.tasks.PrintTask"); so moving forward you won't have to worry about requiring this module.

    Cheers,

     

    Kevin

     

    0
  • Permanently deleted user

    Never even crossed my mind to look there.  This was all i needed.

     

    Thanks Kevin!

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.