I am using the TOC and the Identify task to accomplish the goal of my info-template.
--Trying to get each layer have its own info template based on attributes of that layer. Since not all layers have the same fields Names and attributes.
Thanks,
I will see how that works out. Thanks,
My initial hope was to use the ${*}. I have turned off the fields I do not want displayed before I publish out the service however the OBJECTID field always publishes out with the service no matter if it is turned on or off. In addition it always gives "layername= " I was hoping I would not have to create an infotemplate and set fields for every layer given I have many.
You can set the template to ${*} to get the raw fieldnames and values.
${*} to get the raw fieldnames and values.
InfoTemplate | API Reference | ArcGIS API for JavaScript
You can loop through the attributes of a feature/graphic to create something fancier on the fly:
createTemplate(g){ var template = ["<table>"]; for(var fieldName in g.attributes){ template.push("<tr>"); template.push("<th>"); template.push(fieldName); // add name template.push("</th>"); template.push("<td>"); template.push(g.attributes[fieldName]); // add value template.push("</td>"); template.push("</tr>"); } template.push("</table>"); return template.join(''); }
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.