|
POST
|
When the app fires up the main layer is on while the mezz layer is off. The toggle reverses this so main is off and mezz is on. But when I toggle back to main on and mezz off the link doesn't update. Tried your suggestion with no luck. Is there an option to set it to default right out side the "if" as such: SERVICE_ID: null; Ive tried altering the code a bit: topic.subscribe('toggleChanged', lang.hitch(this, function(visible, layer){
if(layer.title=="layername_Main" && visible){
this.SERVICE_ID = layer.title;
}
else{
this.SERVICE_ID = "_Mezz";
}
})); This way when this code runs: map.infoWindow.setContent('<a href="https://survey123.arcgis.com/share/ID?center='+ evt.mapPoint.getLatitude().toString() + ','+ evt.mapPoint.getLongitude().toString() + '&field:Floor_Selection=' + this.SERVICE_ID.split('_')[1]+"_Floor " + '" target="_"><font size="4">Click here to submit a service request</font></a>'); It will search for the "_" which acts as my flag and pass that over. Same thing though, the link wont switch back to main from mezz even though the layer has physically toggled successfully.
... View more
03-07-2019
10:53 AM
|
0
|
11
|
1376
|
|
POST
|
I have 2 layers in play. My main floor feature service and my second floor (or mezzanine floor) feature service. When the user clicks anywhere on the map, the coordinates are captured which are then passed into a strong which brings them to a link when clicked. This link should also contain if its on the main floor or mezz floor. Right now the link being passed in the correct floor name only up till switching to mezz layer. When switching back to the main floor via the toggle, the floor ;layer physically changes, but the link that I have isn't updated with the proper floor name. Toggling from main to mezz is fine, but mezz to main the link stays on mezz. This has worked before so I am unsure why its causing me issues now. Would it have something to do with the layer name? In the past sometimes the feature service says the name I've setup but it still holds onto the original name in the backend. When this has occurred I've exported the feature class in ArcMap to a new feature class with the correct name and republished which seems to have fixed my problem. This has not unfortunately worked this time.
... View more
03-07-2019
08:51 AM
|
0
|
13
|
1376
|
|
POST
|
When I toggle from mezz back to main the link still stays at mezz. When examined thru a breakpoint (at the if statement level) the if statement is executed at this point as visible is set to true.
... View more
03-06-2019
01:45 PM
|
0
|
17
|
1943
|
|
POST
|
No I cannot remember. I don't believe that I have a post that can help me out
... View more
03-06-2019
09:49 AM
|
0
|
1
|
1311
|
|
POST
|
weird part is that sometimes it works if I copy the feature in ArcMap and rename it to the appropriate name rather than just publishing a new service and naming it accordingly. If I were to change the "if" would this work: if(visible && layer.title=='layername_Main'||visible && layer.title=='layername_Mezz'){
... View more
03-06-2019
09:47 AM
|
0
|
21
|
1943
|
|
POST
|
I've customized Robert's layer toggle widget to look at which layer is currently on and pass this into a popup link that I have. All of my layers follow the same naming scheme of "layername_Main" or "layername_Mezz". The code looks for the underscore symbol as the flag and then applies the main or mezz label to be passed into my link to Survey123. I have all of this done in MapManager.js in the publishMapEvent function (included below) Sometimes this works, other times it doesn't. Right now the toggle switches between the layers (from main to mezz) and the link updates properly. But when I toggle back to main, it stays at mezz label even though the layer changes back to main. I want the label to keep up with the toggle. Any ideas? Thanks _publishMapEvent: function(map) {
topic.subscribe('toggleChanged', lang.hitch(this, function(visible, layer){
if(visible && layer.title=='layername_Main'||layer.title=='layername_Mezz'){
this.SERVICE_ID = layer.title;
}
}));
// create node for the tooltip
var tip = "Click on problem location";
var tooltip = dojo.create("div", { "class": "tooltip", "innerHTML": tip, "style": "color: red; font-size:22px;width:200px"}, map.container);
dojo.style(tooltip, "position", "fixed");
// update the tooltip as the mouse moves over the map
dojo.connect(map, "onMouseMove", function(evt) {
var px, py;
if (evt.clientX || evt.pageY) {
px = evt.clientX;
py = evt.clientY;
} else {
px = evt.clientX + dojo.body().scrollLeft - dojo.body().clientLeft;
py = evt.clientY + dojo.body().scrollTop - dojo.body().clientTop;
}
// dojo.style(tooltip, "display", "none");
tooltip.style.display = "none";
dojo.style(tooltip, { left: (px + 15) + "px", top: (py) + "px" });
// dojo.style(tooltip, "display", "");
tooltip.style.display = "";
// console.log("updated tooltip pos.");
});
// hide the tooltip the cursor isn't over the map
dojo.connect(map, "onMouseOut", function(evt){
tooltip.style.display = "none";
});
//add this property for debug purpose
window._viewerMap = map;
MapUrlParamsHandler.postProcessUrlParams(this.urlParams, map);
console.timeEnd('Load Map');
if (this.map) {
this.map = map;
this.resetInfoWindow(true);
console.log('map changed.');
topic.publish('mapChanged', this.map, this.layerInfosObj);
} else {
this.map = map;
this.resetInfoWindow(true);
topic.publish('mapLoaded', this.map, this.layerInfosObj);
}
require([
'esri/graphic',
'esri/symbols/SimpleMarkerSymbol',
'esri/symbols/SimpleLineSymbol',
'esri/Color'
],
lang.hitch(this, function(Graphic, SimpleMarkerSymbol, SimpleLineSymbol, Color){
var symbol = new SimpleMarkerSymbol(
SimpleMarkerSymbol.STYLE_CIRCLE, 0.01,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_CIRCLE,
new Color([207, 16, 45, 0.9]),
1
),
new Color([207, 16, 45, 0.9])
);
map.on("click", lang.hitch(this, function(evt){
var gra = new Graphic(evt.mapPoint, symbol);
setTimeout(lang.hitch(this, function(){
var selFeats = map.infoWindow.features;
if(!selFeats){
map.graphics.clear();
map.graphics.add(gra);
//PopupCenter('http://www.xtf.dk','xtf','900','500');
map.infoWindow.setContent('<a href="https://survey123.arcgis.com/share/surveycodexyz?center='+ evt.mapPoint.getLatitude().toString() + ','+ evt.mapPoint.getLongitude().toString() + '&field:Floor_Selection=' + this.SERVICE_ID.split('_')[1]+"_Floor " + '" target="_"><font size="4">Click here to submit a service request</font></a>');
SERVICE_ID: null;
map.infoWindow.show(evt.mapPoint);
}
}), 1000);
}));
}));
},
... View more
03-05-2019
07:42 AM
|
0
|
23
|
4344
|
|
POST
|
I will keep this in the back of my mind but my current flow is working fine now. I'm just showing the map in my survey and locking the user out from doing anything. Thanks for the info
... View more
03-04-2019
11:01 AM
|
0
|
0
|
1786
|
|
POST
|
Im going to start at the app level to rule out the duplicate app theory. Where do I look in these files and for what?
... View more
03-04-2019
10:59 AM
|
0
|
3
|
1311
|
|
POST
|
02-28-2019
12:54 PM
|
0
|
7
|
1311
|
|
POST
|
If I did it was awhile ago. What file/folder should I look in?
... View more
02-27-2019
02:02 PM
|
0
|
11
|
2348
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-31-2018 08:24 AM | |
| 3 | 12-18-2018 09:23 AM | |
| 1 | 12-02-2019 07:53 AM | |
| 1 | 04-24-2020 11:11 AM | |
| 1 | 08-14-2019 02:25 PM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:25 AM
|