The sample code
https://developers.arcgis.com/javascript/latest/sample-code/layers-subtypegrouplayer/
seems to be incorrect.
If we change :
Solved! Go to Solution.
I think what the sample is doing is showing how to do different things with the layers. If you click the gear icon on a layer, the "Labels" button will show or hide the labels and the "unique" button will symbolize the data with a simple renderer or a unique-value renderer.
The labelExpression seems to be a mistake. If you replace that line with
labelExpressionInfo: {
expression: "$feature.assetgroup"
}
the labels show unique information
If you find errors in the sample code, it's more helpful to give feedback directly to Esri about this. To do that, scroll to the bottom of the page and click the thumbs down icon. This will bring up a dialog to send a message to the team.
After a little more testing, you can also change it to this to get the same result
labelExpression: "[assetgroup]"
I think what the sample is doing is showing how to do different things with the layers. If you click the gear icon on a layer, the "Labels" button will show or hide the labels and the "unique" button will symbolize the data with a simple renderer or a unique-value renderer.
The labelExpression seems to be a mistake. If you replace that line with
labelExpressionInfo: {
expression: "$feature.assetgroup"
}
the labels show unique information
If you find errors in the sample code, it's more helpful to give feedback directly to Esri about this. To do that, scroll to the bottom of the page and click the thumbs down icon. This will bring up a dialog to send a message to the team.
Thanks for your time and kind efforts.
After a little more testing, you can also change it to this to get the same result
labelExpression: "[assetgroup]"
That is a reasonable design. Thanks for your great assistance.