HOW TO
In ArcGIS Dashboards, enabling row striping for table elements improves readability by visually distinguishing rows with alternating background colors. By default, white and light gray striping is applied, offering limited options for color customization.
In certain scenarios where color adjustment is necessary or preferred, specifying the striping colors ensures better legibility, maintains a consistent visual flow, and aligns the table's appearance with the overall dashboard theme. This article provides the workflow to enable row striping with custom background colors using advanced formatting in ArcGIS Dashboards table elements.
.Note: Enabling advanced formatting causes the existing row striping to be removed from the table element.
var <variable name> = '';
if ($rowindex % 2 == 0) {
color = '<color>';
} else {
color = '<color>';
}
The code below is the full backgroundColor property assigned with the variable from Step 4(a). In this example, the variable is set as color.
backgroundColor: color,

Note: Optionally, remove the unrelated properties from the editor.
The custom row striping colors are applied to the table element in the preview area.

The following shows the complete expression used in this workflow. In this example, hexadecimal values are used to replace <color> from Step 4(a), and the unnecessary properties are removed from the expression.
var color = '';
if ($rowindex % 2 == 0) {
color = '#FFF3CC';
} else {
color = '#FFF9E6';
}
return {
cells: {
FACILITY: {
displayText: $datapoint.FACILITY,
textAlign: 'left',
backgroundColor: color
},
CITY: {
displayText: $datapoint.CITY,
textAlign: 'left',
backgroundColor: color
},
STATE: {
displayText: $datapoint.STATE,
textAlign: 'left',
backgroundColor: color
},
TYPE: {
displayText: $datapoint.TYPE,
textAlign: 'left',
backgroundColor: color
}
}
};

> Save to save the changes.Article ID: 000038623
Get help from ArcGIS experts
Start chatting now