for some reason, when selecting a feature onEdit mode, the EditTemplate window is not showing up. I have it setup to custom fields as code below:
appEditor = { Edit: function (evt) { // alert(evt); if (evt === "Permit") { if (editorWidget) { editorWidget.destroy(); editorWidget = null; } var txtSewerPermit = new dijit.form.TextBox({ id: "txtSP", required: false, promptMessage: "Add Sewer Permit", style: "height:1.8em; width:260px;margin:2px; background-color:#ffd800" }); var txtWaterPermit = new dijit.form.TextBox({ id: "txtWP", required: false, promptMessage: "Add Water Permit", style: "height:1.8em; width:260px;margin:2px; background-color:#ffd800" }); var templateLayers = [permit]; var eDiv = document.createElement("div"); eDiv.id = "editDiv"; document.getElementById('EditContent1').appendChild(eDiv); var eDivTools = document.createElement("div"); eDivTools.id = "editDivTools"; document.getElementById('EditContent1').appendChild(eDivTools); map.infoWindow.resize(400, 350); var editLayerPermit1 = [{ featureLayer: permit, showDeleteButton: false, fieldInfos: [ { 'fieldName': 'Date', 'label': '<table><tr><td style="width:260px;height: 1.8em; margin:2px">Date: </td></tr></table>' }, { 'fieldName': 'ADDRESS', 'label': '<table><tr><td style="width:260px;height: 1.8em; margin:2px">Address: </td></tr></table>' }, { 'fieldName': 'SewerPermit', 'label': 'Sewer Permit: ', customField: txtSewerPermit }, { 'fieldName': 'WaterPermit', 'label': 'Water Permit: ', customField: txtWaterPermit }, { 'fieldName': 'SERVICE_ID', 'label': 'Add Permit: ', customField: "<br /><b> Sewer Permit</b>: <br />" + "<div id='progressNumberSP' style='padding:2px; color:red'></div><input type='file' name='fileToUploadSP' id='fileToUploadSP' onclick='if(!getNoneTxt){this.disabled = true; return false}' onchange='uploadFileSP(this.files[0]);' />" + "<br /><br /><b>Water Permit</b>: <div id='progressNumberWP' style='padding:2px; color:red'></div><input type='file' name='fileToUploadWP' id='fileToUploadWP' onchange='uploadFileWP(this.files[0]);' />" } ] }]; // editLayers; var templatePicker = new esri.dijit.editing.TemplatePicker({ featureLayers: templateLayers, rows: 'auto', columns: 3 }, 'editDiv'); templatePicker.startup(); var settings = { map: map, templatePicker: templatePicker, layerInfos: editLayerPermit1, //editLayerSitePlan1 toolbarVisible: true, enableUndoRedo: true }; var params = { settings: settings }; editorWidget = new esri.dijit.editing.Editor(params, 'editDivTools'); editorWidget.startup(); } }
here is the error I get:
TypeError: undefined is not a function {stack: (...), message: "undefined is not a function"} "TypeError: undefined is not a function
at v._createField (http://js.arcgis.com/3.10/js/esri/dijit/AttributeInspector.js:30:440)
at h._hitchArgs (http://js.arcgis.com/3.10/init.js:173:204)
at Object.h.forEach (http://js.arcgis.com/3.10/init.js:225:144)
at v._createTable (http://js.arcgis.com/3.10/js/esri/dijit/AttributeInspector.js:28:56)
at v._setCurrentLInfo (http://js.arcgis.com/3.10/js/esri/dijit/AttributeInspector.js:19:432)
at v._showFeature (http://js.arcgis.com/3.10/js/esri/dijit/AttributeInspector.js:23:86)
at v._updateSelection (http://js.arcgis.com/3.10/js/esri/dijit/AttributeInspector.js:20:101)
at v.onLayerSelectionChange (http://js.arcgis.com/3.10/js/esri/dijit/AttributeInspector.js:10:321)
at h._hitchArgs (http://js.arcgis.com/3.10/init.js:173:204)
at h.(anonymous function).g [as onSelectionComplete] (http://js.arcgis.com/3.10/init.js:239:390)
----------------------------------------
rejected at a (http://js.arcgis.com/3.10/init.js:196:337)
at k (http://js.arcgis.com/3.10/init.js:196:89)
at f.then.b.then [as then] (http://js.arcgis.com/3.10/init.js:198:308)
at S.selectFeatures (http://js.arcgis.com/3.10/js/esri/layers/FeatureLayer.js:38:212)
at http://js.arcgis.com/3.10/js/esri/dijit/editing/SelectionHelper.js:5:469
at Object.h.forEach (http://js.arcgis.com/3.10/init.js:225:179)
at l.selectFeatures (http://js.arcgis.com/3.10/js/esri/dijit/editing/SelectionHelper.js:5:325)
at l.selectFeaturesByGeometry (http://js.arcgis.com/3.10/js/esri/dijit/editing/SelectionHelper.js:7:214)
at v._updateSelection (http://js.arcgis.com/3.10/js/esri/dijit/editing/Editor.js:39:519)
at null.<anonymous> (http://js.arcgis.com/3.10/js/esri/dijit/editing/Editor.js:33:428)
----------------------------------------
Error
at f.then.b.then [as then] (http://js.arcgis.com/3.10/init.js:198:253)
at S.selectFeatures (http://js.arcgis.com/3.10/js/esri/layers/FeatureLayer.js:38:212)
at http://js.arcgis.com/3.10/js/esri/dijit/editing/SelectionHelper.js:5:469
at Object.h.forEach (http://js.arcgis.com/3.10/init.js:225:179)
at l.selectFeatures (http://js.arcgis.com/3.10/js/esri/dijit/editing/SelectionHelper.js:5:325)
at l.selectFeaturesByGeometry (http://js.arcgis.com/3.10/js/esri/dijit/editing/SelectionHelper.js:7:214)
at v._updateSelection (http://js.arcgis.com/3.10/js/esri/dijit/editing/Editor.js:39:519)
at null.<anonymous> (http://js.arcgis.com/3.10/js/esri/dijit/editing/Editor.js:33:428)
at h.hitch (http://js.arcgis.com/3.10/init.js:174:23)
at v._updateCurrentFeature (http://js.arcgis.com/3.10/js/esri/dijit/editing/Editor.js:17:126)"
is it possible to set the infoTemplate on a dynamicMapServiceLayer as we do a FeatureLayer? I would like to avoid identfy as much as possible. it is the cause of my error as above.
like
var infoTemplateUtilitiesheader = "FacilityID: <b>${Facility Identifier}</b> <br/><br/>";
var infoTemplateUtilitiesBody = "${*}";
var utilitiesLayer = new ArcGISDynamicMapServiceLayer("http://...", {
infoTemplate: new InfoTemplate(infoTemplateUtilitiesheader, infoTemplateUtilitiesBody)
//opacity: .20
});
Richard,
Sure look at the setInfoTemplates function on ArcGISDynamicMapServiceLayer.
ArcGISDynamicMapServiceLayer | API Reference | ArcGIS API for JavaScript
var demographicsLayer = new ArcGISDynamicMapServiceLayer("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/MapServer"); demographicsLayer.setInfoTemplates({ 0: { infoTemplate: popupTemplate } });