I want to retain popupdata which i filled in it, when i close the popup coming from marker symbol , and again open it, my popup refreshed.??
Solved! Go to Solution.
The simple answer is that you assign a unique id as an attribute to the graphic when it is added to the GL.
i removed clone fnc bcz i need to drop different marker every time on mouse click
Rajni,
You have a lot of unneeded redundancy in your code right now.
view.toMap({x:evt.x, y: evt.y})
This portion produces a point class in WKID 102100 (web mercator).
So there is no need for all this code:
var coords = "Lat/Lon " + pt.latitude + " " +pt.longitude;
/* console.log(markertype+" "+comment);*/
var p = new Point({
longitude: pt.latitude,
latitude: pt.longitude,
spatialReference: {wkid: 4326}
});
So your code would look like this instead:
view.on("click", function(evt) {
if(getmarkerclick==true){
var p = view.toMap({x:evt.x, y: evt.y});
var changedSymbol = changedsymbol(markertype);
var g = new Graphic({
geometry: p,
symbol: changedSymbol,
attributes: {
newDevelopment: "new marker",
state: "new",
uniquetype: markertype,
markerId: "static",
comment: comment
}
});
}
}); //End view click
I assume that "markertype" is a global var somewhere else in your code?
Got you sir,
Just one more thing pls tell me how to loop through all markers attributes., i need to save them all with its attributes in db
??? You know how to loop through the graphics in the markerGL right then inside that loop you have a refereence to the graphic and each graphic has attributes object and because you have a limited set of predefined attributes you just get the value of each attribute by name.
graphic.attributes.markerId,
graphic.attributes.comment,
etc.
Ok Why my marker is not cllickable when added on editable polygon, i have to click outside on map ,after that my marker clicks enable.
That's just how it works.
Can i make marker clickable by showing it uneditable all the time, when i click on polygon, then only it should be editable, so that my markers work fine.
Yep. What is making your markers not clickable is the fact that when you are editing a geometry it disables the webmap popups.
yes you are right, polygons stays editable all the time, if it is possible to make it editable only on polygon click,