Select to view content in your preferred language

PopupTemplate Title thousands separator

475
1
Jump to solution
10-27-2022 01:56 PM
MatthewDriscoll
MVP Alum

Is is possible to add the thousands separators in the title section of the popup template?  So 1000 shows as 1,000.   I know you can format in the content using digitSeparator, but I cannot figure out how to do it in the title section.

0 Kudos
1 Solution

Accepted Solutions
LaurenBoyd
Esri Contributor

Hi @MatthewDriscoll ,

This can be done by setting the digitSeparator value of the FieldInfoFormat on the fieldInfos at the PopupTemplate level to true for the particular field you are displaying in the title. Here's an example showing how to do this: https://codepen.io/laurenb14/pen/MWXwKem?editors=1000

const popupTemplate = {
    title: "2010 Population: {POP2010}",
    outFields: ["*"],
    content: "Test Content",
    fieldInfos: [{
        fieldName: "POP2010",
        format: {
            digitSeparator: true,
            places: 0
        }
    }]
};

 Hope this helps!

Lauren

View solution in original post

1 Reply
LaurenBoyd
Esri Contributor

Hi @MatthewDriscoll ,

This can be done by setting the digitSeparator value of the FieldInfoFormat on the fieldInfos at the PopupTemplate level to true for the particular field you are displaying in the title. Here's an example showing how to do this: https://codepen.io/laurenb14/pen/MWXwKem?editors=1000

const popupTemplate = {
    title: "2010 Population: {POP2010}",
    outFields: ["*"],
    content: "Test Content",
    fieldInfos: [{
        fieldName: "POP2010",
        format: {
            digitSeparator: true,
            places: 0
        }
    }]
};

 Hope this helps!

Lauren