I have an info template returning a link.
Right now with I click on it it opens to a new browser tab (_blank)
Looking for 2 options.
1. Display this in a DIV
2. Pop this up into a new floating popup
Any ideas
var infoHighwayCameras = new InfoTemplate();
infoHighwayCameras.setTitle("Highway Cameras");
infoHighwayCameras.setContent("<table>" +
"<tr><td id='tblTitle'>Highway Cameras</td><td id='tblTitle2'></td></tr>" +
"<tr><td id='tblTitleLine'></td><td id='tblTitleLine2'></td></tr>" +
"<tr><td></td><td></td></tr>" +
"<tr><td id='tblMainline1'>image_url</td><td id='tblSubline2'><i>For Camera Image <a href='${image_url}' target='_blank'><font color='0x84CCDA'>click here</font></a>."+
"</table><hr>");
Solved! Go to Solution.
Jay,
You definitely do Not want your layer to refresh from the server every second... Very bad idea. Can you provide a complete sample for me to play with?
Jay,
The image_url attribute updates offten you said. so the attribute will Not change unless the layer is requesting the new data from the server. The refreshInterval tells the layer to refresh from the server in the time specified in that property. Yes refreshInterval is a construction option for a FeatureLayer.
The URL to the image is always the same....this does not change....only the image in the database on their side of the fence....
It refreshes in a popup window but not the InfoTemplate....hmmmmmm
If you open this in a browser and keep refreshing the image changes...about every 10 seconds or so
https://images.skyvdn.com/thumbs/RichmondCS64EB1729.flv.png
But this does not happen when I have it in the InfoTemplate and click on the same Feature again and again.
I meant a JS code sample.
This is what i am doing now....
I might be missing what you are saying...I apologize... just trying to nip this in the rear
If you still have to patience can you please try to explain my options to get the InfoTemplate to refresh a new image.
var infoHighwayCameras = new InfoTemplate();
infoHighwayCameras.setTitle("Highway Cameras");
infoHighwayCameras.setContent(getTextContent);
function getTextContent(graphic) {
return "<table>" +
"<tr><td id='tblTitle'>Highway Cameras</td><td id='tblTitle2'></td></tr>" +
"<tr><td id='tblTitleLine'></td><td id='tblTitleLine2'></td></tr>" +
"<tr><td id='tblMainline1'>description</td><td id='tblSubline2'> " + graphic.attributes.descriptio + " </td></tr>" +
"<tr><td id='tblMainline1'>image_url</td><td id='tblSubline2'><img src= " + graphic.attributes.image_url + " /></td></tr>" +
"</table><hr>";
}
var HighwayCameras = new FeatureLayer("https://services.arcgis.com/DO4gTjwJVIJ7O9Ca/arcgis/rest/services/Camera_Location_VDOT/FeatureServer/0", {
mode: FeatureLayer.MODE_ONDEMAND,
visible: false,
opacity: .5,
outFields:["*"],
infoTemplate: infoHighwayCameras
});
HighwayCameras.refreshInterval = 0.1;
legendLayers3.push({ layer: HighwayCameras, title: 'Highway Cameras' });
Jay,
Sorry for not being clear. I was asking for a full html sample so I did not have to spend time building one myself using your data. That way I can just run it and test.
OK will get you one.
OK I tried to strip out as much noise as I could...
Index.html should be main file to point to in IIS.
index.js file in the js folder
Open the app
Zoom out a bit to see Image Features
Click the Information Tab on left
Click a Feature
Click a different Feature (wait couple minutes)
Click the 1st feature notice this does not update.
Jay,
So the url does not change for the feature only the returned image does?