Select to view content in your preferred language

LocalLayer - Change symbology for selected feature

1426
2
Jump to solution
04-27-2016 11:37 AM
NatashaManzuiga
Regular Contributor

Hi, how can I set highlight symbology for a feature layer in the LocalLayer widget?

Thanks.

Naty

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Naty,

  Just add this line 39  to the below code block in the Widget.js for the Local Layer Widget

}else if (layer.type.toUpperCase() === 'FEATURE') {
            var _popupTemplate;
            if (layer.popup){
              _popupTemplate = new PopupTemplate(layer.popup);
              lOptions.infoTemplate = _popupTemplate;
            }
            if(layer.hasOwnProperty('mode')){
              var lmode;
              if(layer.mode === 'ondemand'){
                lmode = 1;
              }else if(layer.mode === 'snapshot'){
                lmode = 0;
              }else if(layer.mode === 'selection'){
                lmode = 2;
              }
              lOptions.mode = lmode;
            }
            lOptions.outFields = ['*'];
            if(layer.hasOwnProperty('autorefresh')){
              lOptions.refreshInterval = layer.autorefresh;
            }
            if(layer.hasOwnProperty('showLabels')){
              lOptions.showLabels = true;
            }
            lLayer = new FeatureLayer(layer.url, lOptions);
            if(layer.name){
              lLayer._titleForLegend = layer.name;
              lLayer.title = layer.name;
              lLayer.noservicename = true;
            }
            if(layer.hasOwnProperty('definitionQuery')){
       lLayer.setDefinitionExpression(layer.definitionQuery);
            }
            if(layer.hasOwnProperty('customRenderer')){
      if (layer.customRenderer != ""){
      lLayer.setRenderer(new esri.renderer.SimpleRenderer(jsonUtils.fromJson(JSON.parse(layer.customRenderer))))
      }
            }
            lLayer.setSelectionSymbol(new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, null, new Color([109,207,246,0.6])));

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Naty,

  Just add this line 39  to the below code block in the Widget.js for the Local Layer Widget

}else if (layer.type.toUpperCase() === 'FEATURE') {
            var _popupTemplate;
            if (layer.popup){
              _popupTemplate = new PopupTemplate(layer.popup);
              lOptions.infoTemplate = _popupTemplate;
            }
            if(layer.hasOwnProperty('mode')){
              var lmode;
              if(layer.mode === 'ondemand'){
                lmode = 1;
              }else if(layer.mode === 'snapshot'){
                lmode = 0;
              }else if(layer.mode === 'selection'){
                lmode = 2;
              }
              lOptions.mode = lmode;
            }
            lOptions.outFields = ['*'];
            if(layer.hasOwnProperty('autorefresh')){
              lOptions.refreshInterval = layer.autorefresh;
            }
            if(layer.hasOwnProperty('showLabels')){
              lOptions.showLabels = true;
            }
            lLayer = new FeatureLayer(layer.url, lOptions);
            if(layer.name){
              lLayer._titleForLegend = layer.name;
              lLayer.title = layer.name;
              lLayer.noservicename = true;
            }
            if(layer.hasOwnProperty('definitionQuery')){
       lLayer.setDefinitionExpression(layer.definitionQuery);
            }
            if(layer.hasOwnProperty('customRenderer')){
      if (layer.customRenderer != ""){
      lLayer.setRenderer(new esri.renderer.SimpleRenderer(jsonUtils.fromJson(JSON.parse(layer.customRenderer))))
      }
            }
            lLayer.setSelectionSymbol(new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, null, new Color([109,207,246,0.6])));
NatashaManzuiga
Regular Contributor

Thanks

0 Kudos