Issue with Spatial Editing for Point Feature

746
8
11-26-2016 11:22 PM
NiladriBanerjee
New Contributor

Hi All,

I  am having an issue with the spatial editing for point feature. For the spatial editing we have referred the sample the code given in the example.

ArcGIS API for JavaScript Sandbox 

This code is working fine for point feature if we don't change  the position and the style  of the default info window which opens when we click on any feature in spatial editing environment. However if we change the style and position of default window to open in a side panel and in that case moving of point feature is not happening while moving of line and polygon feature is working in the side panel info window. Please refer the attached image with the name of "working.jpg" and "notworking.jpg"

Any help concerning this issue will be highly appreciated.

Thanks,

Niladri Banerjee

GIS Developer

Stesalit Systems Ltd.

Tags (1)
0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Niladri,

So are you combining the Popup content in side panel sample with the editing widget sample?

0 Kudos
NiladriBanerjee
New Contributor

Hi Robert,

Thanks for your reply. Yes you are right we are combining the Popup content in side panel sample with the editing widget sample. Is that causing the issue? 

Thanks,

Niladri

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Niladri,

   It could be in how you combined them. Can you post your code?

0 Kudos
NiladriBanerjee
New Contributor

Here is the code.

*********************************************************************************************************************************

this._map.infoWindow.set("popupWindow", false);

this.initializeSidebar(this._map);

initializeSidebar: function(map){

var popup = map.infoWindow;

connect.connect(popup, "onSelectionChange", function(e){

var edithasClass = $("#editFeature").hasClass("active");

displayPopupContent(popup.getSelectedFeature(),domStyle,menus,DeleteFeature,edithasClass);

});

//when the selection is cleared remove the popup content from the side panel. 

connect.connect(popup, "onClearFeatures", function(){

var edithasClass = $("#editFeature").hasClass("active");

if(edithasClass==false){   

  $("#sidepanelAllPourposeContent").html('');

}

});

}

main.js

$("#editFeature").on('click', function(e) {

$("#editFeature").toggleClass("active");

var edithasClass = $("#editFeature").hasClass("active");

if(edithasClass==false){

var stackedAreaLegend = dijit.byId('sidepanelSpatialEditing');

if (stackedAreaLegend) {

  stackedAreaLegend.destroyRecursive(true);

}

}

   

if(edithasClass==true){

initEditing(e,array,Editor,domStyle,menus,i18n,draw);

}

 });

 

//functions.js

function initEditing (event,arrayUtils,Editor,domStyle,i18n,draw) {

   

 //allLayers -- It's a global variable;

 

          var featureLayerInfos = arrayUtils.map(allLayers, function (layer) {

       return {

              "featureLayer": layer

            };

          });

 var stackedAreaLegend = dijit.byId('sidepanelSpatialEditing');

if (stackedAreaLegend) {

  stackedAreaLegend.destroyRecursive(true);

}

          var settings = {

            map: map,

            layerInfos: featureLayerInfos

          };

          var params = {

            settings: settings

          };

          var editorWidget = new Editor(params, 'sidepanelSpatialEditing');

          editorWidget.startup();

          //snapping defaults to Cmd key in Mac & Ctrl in PC.

          //specify "snapKey" option only if you want a different key combination for snapping

          map.enableSnapping();

}

function displayPopupContent(feature,domStyle,menus,DeleteFeature,edithasClass){

var stackedAreaLegend = dijit.byId('sidepanelAllPourposeContent');

if (stackedAreaLegend) {

  stackedAreaLegend.destroyRecursive(true);

}

if(feature){

var content = feature.getContent();

$("#sidepanelAllPourposeContent").html(content);

if(edithasClass==true){

        $("#sidepanelAllPourposeHeadingSpan").html('Spatial Editing');

}

if(edithasClass==false){

           $("#sidepanelAllPourposeHeadingSpan").html(feature._layer.id);

$("#sidepanelAllPourposeContent" ).accordion();

$("#sidepanelAllPourposeContent").accordion( "destroy" );

if(feature._layer.id!='Photos'){

var mapserviceid = $("#associatedForms").attr("mapServiceId");

var objectId = $("#associatedForms").attr("objectId");

var allLoadedService = JSON.parse(localStorage.getItem('loadedServicesstored'));

var allForms ='<table class="table table-striped table-bordered"><tbody>';

for (var i = 0; i < allLoadedService.length; i++) {

if(mapserviceid == allLoadedService.map_service_id){

if(allLoadedService.forms.length==0){

allForms += '<tr class="clickable desc"><td>No Forms Found.</td></tr>' ;

}else{

for (var j = 0; j < allLoadedService.forms.length; j++) {

allForms += '<tr class="clickable desc" ng-click="showCompleted("'+allLoadedService.forms.form_definition_id+'")" ><td>'+allLoadedService.forms.title+'</td></tr>';

}

 

}

allForms += '</tbody></table>';

break;

}

}

$("#associatedForms").html(allForms);

}

$("#sidepanelAllPourposeContent" ).accordion({

collapsible: true,

active: 2,

heightStyle: "content"

});

$("#associatedForms").mCustomScrollbar({

scrollButtons:{enable:true},

theme:"minimal-dark"

});

$("#associatedFormResult").mCustomScrollbar({

scrollButtons:{enable:true},

theme:"minimal-dark"

});

$("#gisAttributes").mCustomScrollbar({

scrollButtons:{enable:true},

theme:"minimal-dark"

});

}

if(edithasClass==true){

var layerId = feature._layer.id;

                new AttributeEditor({graphic:feature, layerId:layerId, exists:true});

}

$(".sideplanelContent").on("click", function(e) {

                if(e.target.id == 'edit-btn' || e.target.id == 'edit-img') {

e.stopPropagation();

                    var layerId = feature._layer.id;

                    new AttributeEditor({graphic:feature, layerId:layerId, exists:true});

                  //  menus.openAttributeEditor();

/*$(".contentWrapEdit").mCustomScrollbar({

scrollButtons:{enable:true},

theme:"minimal-dark"

});*/

                } else if(e.target.id == 'del-btn' || e.target.id == 'del-img') {

e.stopPropagation();

DeleteFeature.DeleteFeature(feature._layer.id,feature);

                    

                    

} else if (e.target.id === 'attachments-btn' || e.target.id == 'attachments-img') {

                    Event.stop(e);

                    openAttachmentsModal();

                } else if(e.target.id == 'form-btn' || e.target.id == 'form-img') {

                    Event.stop(e);

                    openFormsModal();

                } else if(e.target.id == 'cancel-button') {

                    Event.stop(e);

                    map.infoWindow.hide();

                }

            });

if(edithasClass==false){

$( "#sidepanelAllPourposeContent" ).accordion( "refresh" );

}

}

}

****************************************************************************************************************************************

Thanks,

Niladri

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Niladri,

   Sorry I can not make sense of the code you posted.

0 Kudos
NiladriBanerjee
New Contributor

Hi Robert,

For your better understanding I have simplified the code. In the attachment I have shared three java script files( bootstrapmap.js,main.js,function.js) which we are using for the spatial editing. From the bootstrapmap.js file we are setting default pop up window to false and then we are calling the function "displayPopupcontent()" function of function.js  file and in this function  we have taken the sample code of "https://developers.arcgis.com/javascript/3/sandbox/sandbox.html?sample=popup_sidepanel"
and from main.js we are calling "initEditing()" function of function.js file and in this function we have taken the sample code of 
Hope I am able to make you understand the code and still if you have any question please let me know.
Thanks,
Niladri
0 Kudos
SarojThapa1
Occasional Contributor III

Hey Niladri,

Are you using the default Geometry Server of ArcGIS? If you have your own Geometry Service, replace the default ArcGIS Geometry Service with yours in the following codes.

esriConfig.defaults.geometryService = new GeometryService("https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");  // Replace this with your own Geometry Service.

See if it will work. 

Goodluck.

0 Kudos
NiladriBanerjee
New Contributor

Hi Saroj,

Thanks for your reply, actually we are using ArcGIS Online services can you please tell me where we will get the geometry service for ArcGIS online? 

I would also like to let you know that without using the geometry service we are able to do the spatial editing for line and polygon layer.

Thanks,

Niladri

0 Kudos