Does anyone know why using this construct in an infowindow won't allow me to display anything less than three decimal places?
Here is the complete construct:
var resTemplate = new InfoTemplate();
resTemplate.setTitle("Customer Residence");
resTemplate.setContent(
"<b>Distance to Store: </b>${MI_TO_STORE:NumberFormat(round:2)} miles");
I have tried using both 2 and 1 and even changing the format of my data layer before publishing it to 2 decimal places, but the infowindow insists that it give me three decimal places.
Thanks in advance for any suggestions or insights.
Solved! Go to Solution.
Donald,
The proper format is this:
${MI_TO_STORE:NumberFormat(places:2)}
it is places not round.
Donald,
The proper format is this:
${MI_TO_STORE:NumberFormat(places:2)}
it is places not round.
Thank you. That did the trick. I'm almost sure I saw example code where the code listing used 'round', but 'places' did actually display the desired 2 decimal places.
Yes. Here's where I saw 'round' in use:
Format dates in an info window | ArcGIS API for JavaScript
I'm not arguing that it should work, just saying a search on 'arcgis javascript api round' led me there.
Thanks again