Initialize Editor throw error:

4602
3
Jump to solution
03-17-2015 02:18 AM
MohammedAbdulMateen
New Contributor II

Uncaught TypeError: Cannot read property 'decimalFormat' of undefined     Editor.js:522

code below:

require([

        "dojo/parser",

        "dijit/layout/BorderContainer",

        "dijit/layout/ContentPane",

        "esri/map",

        "esri/toolbars/edit", "esri/layers/ArcGISTiledMapServiceLayer", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/FeatureLayer", "esri/Color",

        "esri/config",

        "esri/tasks/GeometryService",

        "esri/urlUtils",

        "esri/arcgis/utils",

        "dojo/dom",

        "dojo/_base/array",

        "dijit/Toolbar", "esri/dijit/Popup", "dojox/layout/FloatingPane", "dojox/layout/ExpandoPane", "esri/toolbars/navigation", "esri/dijit/Print", "esri/tasks/PrintTemplate", "dojo/request/xhr", "dijit/form/ComboBox", "dijit/form/Button", "esri/dijit/editing/Editor", "esri/dijit/editing/TemplatePicker", "dojo/i18n!esri/nls/jsapi", "dojo/keys",

        "dojo/domReady!"

], function (parser, BorderContainer, ContentPane, Map, Edit, ArcGISTiledMapServiceLayer, ArcGISDynamicMapServiceLayer, FeatureLayer,Color, config, GeometryService, urlUtils, arcgisUtils, dom, array, Toolbar, Popup, FloatingPane, ExpandoPane, Navigation, Print, PrintTemplate, xhr, ComboBox, Button, Editor,TemplatePicker,jsapiBundle, keys

        ) {

  

   

    loading = dojo.byId("loadingImg");  //loading image. id

    edtest = Editor;

   esri.config.defaults.io.alwaysUseProxy = false;

    esri.config.defaults.io.corsEnabledServers.push(app.AppCors_Url);

    esri.config.defaults.io.proxyUrl = app.proxy_Url;

    //Geometry Service

    geometrysvc = new esri.tasks.GeometryService(app.geometryService_Url);

    esri.config.defaults.geometryService = geometrysvc;

  

    popup = new esri.dijit.Popup(null, dojo.create("div"));

    var sliderPos = "top-right";

    if ($("#HdnLanguage").val() == "en-US") {

        sliderPos = "top-left";

    }

  map = new Map("map", {

        sliderStyle: "large",

        sliderOrientation: "vertical",

        sliderPosition: sliderPos

    });

    app.map = map;

    dojo.connect(app.map, "onUpdateStart", showLoading);

    dojo.connect(app.map, "onUpdateEnd", hideLoading);

    //Map extents change event

    dojo.connect(app.map, "onExtentChange", function (extent) {

        bExtentChange = true;

        previousExtent = extent;

        //scale

        scale = app.map.getScale();

        var ScaleValue = document.getElementById("lstscale");

        document.getElementById("lstscale").value = app.map.__LOD.scale;

        //Register UserOpen Application

  

        //dojo.byId("mouseCordinates").innerHTML = "<b>Lat : </b>" + pt1.y.toFixed(8) + ", <b>Long : </b>" + pt1.x.toFixed(8) + " / <b>X : </b>" + mp.x.toFixed(3) + ", <b>Y : </b>" + mp.y.toFixed(3) + ", <b> Scale : </b>" + scale;

        if (pt1 != undefined) {

            // for utm coordinates

            var getvar = ToUTM(pt1.y, pt1.x);

            var utmy = parseFloat(getvar.split('|')[0]);

            var utmx = parseFloat(getvar.split('|')[1]);

            var lang1 = $("#HdnLanguage").val();

            if (lang1 == "ar-SA") {

                dojo.byId("mouseCordinates").innerHTML = "<b>X : </b>" + pt1.x.toFixed(3) + ", <b>Y : </b>" + pt1.y.toFixed(3) + "/ <b> مستوى : </b>" + scale;

            }

            else {

                dojo.byId("mouseCordinates").innerHTML = "<b>X : </b>" + pt1.x.toFixed(3) + ", <b>Y : </b>" + pt1.y.toFixed(3) + " / <b> Scale : </b>" + scale;

            }

        }

      

    });

    app.map.disableClickRecenter();

    dojo.connect(app.map, "onLoad", mapReady);

    //LandBase Service

    app.BaseMapLandBase_Service = new ArcGISTiledMapServiceLayer(app.BaseMapLandBase_Url);

    if (app.BaseMapLandBase_Service.loaded) {

        SetLabels(app.BaseMapLandBase_Service);

    }

    else {

        dojo.connect(app.BaseMapLandBase_Service, "onLoad", SetLabels);

        dojo.connect(app.BaseMapLandBase_Service, "onError", showMapServiceError);

    }

    app.map.addLayer(app.BaseMapLandBase_Service);

    //ElectricGrid Service

    app.ElectricGrid_Service = new ArcGISDynamicMapServiceLayer(app.ElectricGrid_Url);

    app.PKMapservice_Service = new ArcGISDynamicMapServiceLayer(app.PKMapservice_Url);

    app.map.addLayer(app.ElectricGrid_Service);

    app.map.addLayer(app.PKMapservice_Service);

  

 

  

    customerLocationLayer = new esri.layers.FeatureLayer(app.PKEditingService_Url + "/" + customerlocationlayerid, {

        mode: esri.layers.FeatureLayer.MODE_SELECTION,

        outFields: ["OBJECTID", "ORDERNO", "DESCRPTION", "CREATED", "DISTRICTNAME", "DISTRICTNO", "AREANO", "MASARNO", "USERCREATED", "X", "Y", "USERID", "LASTMODIFIED"]

    });

  

    operationsPolygonLayer = new esri.layers.FeatureLayer(app.PKEditingService_Url + "/" + kashfealayerid, {

        mode: esri.layers.FeatureLayer.MODE_SELECTION,

        outFields: ["OBJECTID", "REQUISITENO", "CUSTOMERVIP", "CUSTOMERNAME", "ORDERTYPE", "DISTRICT", "DEEDNO", "DEEDDATE", "BLDPERMNO", "BLDPERMDATE", "NEAREST_CUSTOMER", "NEAREST_STATION", "STATUS", "MOBILE"

, "USERCREATED", "CREATED", "USERID", "LASTMODIFIED", "PLANNO", "PLOTNO", "NATIONAL_ID"]

    });

    navToolbar = new esri.toolbars.Navigation(app.map);

    dojo.connect(navToolbar, "onExtentHistoryChange", extentHistoryChangeHandler);

    var EditEvent = dojo.connect(app.map, "onLayersAddResult", initEditingFunc);

    //Adding MapServices to Map

   app.map.addLayers([operationsPolygonLayer, customerLocationLayer]);

});

function initEditingFunc(){

var editr=new Editor();

}

0 Kudos
1 Solution

Accepted Solutions
MohammedAbdulMateen
New Contributor II

I solved it by

1.first loading  jquery library  then arcgis library then customised javascript files

2.Bring all the imports from contentpage to master page.

Hope this helpfull for others

View solution in original post

0 Kudos
3 Replies
KenBuja
MVP Esteemed Contributor

When you initialize the Editor, you have to include the parameters that define the functionality of the editor widget (in params) and the HTML element where the widget should be rendered (in srcNodeRef).

var editr = new Editor(params, srcNodeRef);

As you can see in the documentation, these two items are required.

0 Kudos
MohammedAbdulMateen
New Contributor II

Thanks for your reply, the error is thrown at first line,i mean in require() statement,

this error started after updating arcgis javascript api from 3.7  to 3.12 

any help highly appriciated.

require([

        "dojo/parser",

        "dijit/layout/BorderContainer",

        "dijit/layout/ContentPane",

        "esri/map",

        "esri/toolbars/edit", "esri/layers/ArcGISTiledMapServiceLayer", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/FeatureLayer", "esri/Color",

        "esri/config",

        "esri/tasks/GeometryService",

        "esri/urlUtils",

        "esri/arcgis/utils",

        "dojo/dom",

        "dojo/_base/array",

        "dijit/Toolbar", "esri/dijit/Popup", "dojox/layout/FloatingPane", "dojox/layout/ExpandoPane", "esri/toolbars/navigation", "esri/dijit/Print", "esri/tasks/PrintTemplate", "dojo/request/xhr", "dijit/form/ComboBox", "dijit/form/Button", "esri/dijit/editing/Editor", "esri/dijit/editing/TemplatePicker", "dojo/i18n!esri/nls/jsapi", "dojo/keys",

        "dojo/domReady!"

], function (parser, BorderContainer, ContentPane, Map, Edit, ArcGISTiledMapServiceLayer, ArcGISDynamicMapServiceLayer, FeatureLayer,Color, config, GeometryService, urlUtils, arcgisUtils, dom, array, Toolbar, Popup, FloatingPane, ExpandoPane, Navigation, Print, PrintTemplate, xhr, ComboBox, Button, Editor,TemplatePicker,jsapiBundle, keys

        ) {

0 Kudos
MohammedAbdulMateen
New Contributor II

I solved it by

1.first loading  jquery library  then arcgis library then customised javascript files

2.Bring all the imports from contentpage to master page.

Hope this helpfull for others

0 Kudos