Label can't access added attribute

المشرف العام

Administrator
طاقم الإدارة
I have a layer that gets created with a couple of attributes, one of which is NAME. Then I create a LabelLayer and add a feature layer like so:

layerLabel.addFeatureLayer(layerDisplay, rendererLbl, "{NAME}", { pointPriorities: 'CenterCenter' });And this works fine. The NAME is displayed where I'd expect it to be displayed. But, I also want to add more attributes, so I have some code that adds an attribute called VALUE and then, on the update-end event of layerDisplay, I add my label layer like so:

layerLabel.addFeatureLayer(layerDisplay, rendererLbl, "{NAME} {VALUE}", { pointPriorities: 'CenterCenter' });But it will display as, for example: Alaska {VALUE}. Why won't it see the VALUE attribute? If I add a break point before the label layer is added, I can do this:

console.log(layerDisplay.graphics[0].attributes);And I can see that both the NAME and the VALUE attributes are there.



أكثر...
 
أعلى