Labels work in WAB DE but not in deployed site

863
6
Jump to solution
11-07-2017 01:35 PM
KenBuja
MVP Esteemed Contributor

I want to show labels for a Feature Layer (this._layerSPGrid) that I've added to the map. I use this code to add them

    var label = new TextSymbol();
    label.color.setColor(new Color('black'));
    label.font.setSize('8pt');
    label.font.setFamily("arial");
    var json = {
      labelExpressionInfo: { value: '{' + this._fieldPriority + '}' }
    }
    var labelClass = new LabelClass(json);
    labelClass.symbol = label;
    this._layerSPGrid.setLabelingInfo([labelClass]);

This works in the app running in Developer Edition. However, when I deploy the app to my server, the labels don't show up. I've stepped through the debugger and it hits all the lines without throwing any errors.

Any ideas why the labels don't show on the server?

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Ken,

   To make them appear automatically just add 

"showLabels": true

to the "mapOptions": {}, portion of the apps main config.json

View solution in original post

6 Replies
RobertScheitlin__GISP
MVP Emeritus

Ken,

   In the LayerList widget do you get the menu option to show labels for that layer?

0 Kudos
KenBuja
MVP Esteemed Contributor

Thanks, Robert, I had completely overlooked that option. Clicking that does turn the labels on.

However, I am still curious as to why the label appear automatically in the DE version but not the deployed version.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Ken,

   To make them appear automatically just add 

"showLabels": true

to the "mapOptions": {}, portion of the apps main config.json

GeorgeKatsambas
Occasional Contributor III

Where is the menu option to show labels for a layer?

0 Kudos
KenBuja
MVP Esteemed Contributor

Click on the ... for the layer and you'll see the option

0 Kudos
GeorgeKatsambas
Occasional Contributor III

I don't have that option? I published to server with a scale range on layers will that affect it

0 Kudos