AnsweredAssumed Answered

Cluster Query widget results

Question asked by bsniderInnovate on Sep 24, 2017

Hi,

 

I am customizing the default WAB Query widget.  I am trying to display the resulting layer as a ClusterLayer, instead of a FeatureLayer.  To do so, I am using the ClusterLayer.js file from the Summary widget.

 

The Query widget's Widget.js file creates the query's returned FL in the _createNewResultLayer function like so:

resultLayer = new FeatureLayer(featureCollection);

 

I commented this out, and replaced it with:

resultLayer = new ClusterLayer({
id: this.label,
distance: 20,
displayOnPan: true,
map: this.map,
clusterSize: 120,
color: "#6e6e6e",
countField: null,
features: [featureCollection]
});

 

Besides adding ClusterLayer.js as a class in the require statement, the only other code I've changed in Widget.js was commenting out the following (at the end of the _createNewResultLayer function).

          // if(!currentAttrs.config.useLayerSymbol && currentAttrs.config.resultsSymbol){
          //   var symbol = symbolJsonUtils.fromJson(currentAttrs.config.resultsSymbol);
          //   renderer = new SimpleRenderer(symbol);
          //   resultLayer.setRenderer(renderer);
          // }

 

I've been sifting through the code in Chrome, but can't figure out why the layer isn't displaying on the map.  The layer is definitely being added to the map object, along with its features:

 

ClusterLayer added to map object in console

 

Any insight is greatly appreciated!

 

Brad

Outcomes