Popup.open() function used to highlight feature have an unstable error @ ArcGIS for JavaScript 4.20

1169
3
Jump to solution
08-23-2021 09:18 AM
ForyondChao
New Contributor II

My Server is ArcGIS Server 10.2,I published the mapping service using ArcMap 10.2 , and the layers data from database (SQL Server 2019) directly.  When I don't register the database, publishing maps automatically copies the data from the database to the server ,  a new unique field called OBJECTID is automatically added to the layer properties table ,  Popup is right now.

but, when I register the database to ArcGIS Server,  I  call the  popup.open()  function to show a feature's property,  some unfixed errors have occurred.   I noticed that the new unique field added by ArcGIS changed from OBJECTID to ESRI_OID,  I modified the codes, but, error still.  The error appeared is that when I popup a feature, the highlight geometry is part of the target feature or sometime is other feature. something like this:

ForyondChao_2-1629734883192.png

but now the geometry obtained from server is correct, there are 6 points for the geometry.

ForyondChao_3-1629734985248.png

Here is my code.

ForyondChao_4-1629735164174.png

Could you please tell me how to fix this bug  or  possible reasons? Looking forward to your reply, Thanks!

 

0 Kudos
1 Solution

Accepted Solutions
ForyondChao
New Contributor II
I used a simple method to get around this problem

1. Turn popUp's built-in highlighting off.

const view = new MapView({

 popup:{highlightEnabled:false}

})

2. Use the default graphic in the View to add color for geometry every time it is selected.

sym= new {

type:"simple-fill",

color:[0,255,255,0.5],

style:"solid",

outline:{color:[255,255,0], width:1, style:"solid"}

}

view.graphics.add(new Graphic({geometry:geometry, symbol:sym}));

Now I can achieve my goal, thanks to the forum!

View solution in original post

0 Kudos
3 Replies
ForyondChao
New Contributor II

Hi  GarryGoldberg!

How do you to solve the problem ? 

0 Kudos
ForyondChao
New Contributor II
I used a simple method to get around this problem

1. Turn popUp's built-in highlighting off.

const view = new MapView({

 popup:{highlightEnabled:false}

})

2. Use the default graphic in the View to add color for geometry every time it is selected.

sym= new {

type:"simple-fill",

color:[0,255,255,0.5],

style:"solid",

outline:{color:[255,255,0], width:1, style:"solid"}

}

view.graphics.add(new Graphic({geometry:geometry, symbol:sym}));

Now I can achieve my goal, thanks to the forum!
0 Kudos
kukiyang
New Contributor

this is awesome, try it out! https://word-unscrambler.io

0 Kudos