Select to view content in your preferred language

Popup Template Formatter Enhancements

589
0
10-07-2016 01:25 PM
Status: Open
roemhildtg
Frequent Contributor

Format Popup Content | Guide | ArcGIS API for JavaScript 3.18 

This page describe the details on formatting a popup using several different properties. The popup template is fairly flexible, but enhancements could be made to make it a lot more useful, with minimal effort. 

Add the ability to provide a custom formatter for any field, not just date and number types. The formatter property already exists, but it doesn't allow any real customizing for formatting values...

  • Yes, I can provide a content property, that will allow me to do this, but if I simply want to turn one field into a link, now I have to write an entire template up that looks like a table and then format the one field that I want into a link. 
  • Yes, links are already automatically converted into anchors, BUT not if they are missing http or require multiple fields to build...
  • Additionally, it would be ideal if this formatter was a function that could utilize other fields to build a formatted value.
  • Example:
  • function(value, otherAttributes){ return lang.replace('<a href="fieldName">{otherFieldName}</a>', attributes); }

This would allow the most flexibility and since I'm using a dojo template above, it would be easy to read and set up. 

As I mentioned, the formatter property already exists, it just needs to be tweaked to be more flexible, and allow for other attributes to be used in the formatter function. 

Tags (2)