popups-default
This bundle provides a default popup definition to show details of map features with little configuration effort. It displays attributes in a grid layout and shows attachments if the layer provides attachments.
Usage
To use default popups, add this bundle to your app.
This bundle interprets the popupType
value default
at popup templates.
For more information about how to disable the default popup mechanism, how to use your own popup implementation as a default, or how to use this popup definition for specific layers only, see the popups bundle configuration.
Configuration reference
The following configuration options apply for all layers in an app. To customize the default popup behavior for a single layer, see Customize the popup of a single layer.
The following code sample shows all configurable properties and their default values:
"popups-default": {
"Config": {
"defaultTitle": "Object",
"excludedFields": [
"objectid",
"objectid_0",
"objectid_1",
"shape",
"shape_length",
"shape_area",
"st_area(shape)",
"st_length(shape)",
"st_area",
"st_length"
],
"enableAttachments": true,
"attachmentsDisplayType": "list",
"places": 2,
"digitSeparator": true,
"dateFormat": "short-date-short-time-24",
"preferDefaultPopupTemplate": false,
"hideEmptyFields": false
}
}
Property | Type | Description |
---|---|---|
defaultTitle |
String | A static fallback title (see Title of default popups). |
excludedFields |
Array of Strings | Defines a case insensitive list of fields that are not displayed in popups. To display all fields, set "excludedFields": [] . |
enableAttachments |
Boolean | To always hide attachments, set this property to false . |
attachmentsDisplayType |
String | To show attachments as links, use list . To show a thumbnail of each attachment, use preview . |
places |
Number | Number of decimal places for a single or double float number. |
digitSeparator |
Boolean | Defines, if numerical values are displayed with a number separator. |
dateFormat |
String | Defines how date values are formatted. For possible values, see dateFormat in the ArcGIS Maps SDK for JavaScript documentation. |
preferDefaultPopupTemplate |
Boolean | To use the default popup template that is added to layers by the ArcGIS Maps SDK for JavaScript, set this value to true . |
hideEmptyFields |
Boolean | To hide empty fields from the grid layout, set this value to true . |
Title of default popups
The title of default popups is determined dynamically by rules in the following priority:
- A custom title is configured at the
popupTemplate
of the layer. - A
displayField
is available in the layer. - A title from the property
defaultPopupTemplate
is available. - A
objectIdField
is available in the layer.
The property defaultTitle
is used as a fallback if none of the rules apply.
Use cases
Customize the popup of a single layer
To customize the popup of a certain layer, set the config
property in its popupTemplate
.
To customize the title, use the title
property.
The following code sample shows how to customize the popup of a layer:
"layers": [
{
...
"popupTemplate": {
"popupType": "default",
"title": "My Object: {objectid}",
"config" : {
// works as addition to global configured excluded fields
"excludedFields": [
"speciallayerfield"
],
"places": 4
}
}
}
]