Select to view content in your preferred language

Change FeatureLayer renderer in ExB custom widget

1207
2
Jump to solution
04-14-2023 07:56 AM
Labels (1)
MarcBate
Frequent Contributor

I am creating a custom widget for ExB that is based on the filter widget. I'd like to modify the data source (feature layer) used for the filtering and change its renderer, specifically set it to a class breaks renderer with breaks depending on what filtered values they selected. I was able to create the renderer object but when I try to set the FeatureLayer.renderer = render, nothing happens. I assume that is because ExB is getting the renderer from the web map still. I was thinking maybe having to use LayerView but don't see a renderer property on it. Any ideas? 

1 Solution

Accepted Solutions
MarcBate
Frequent Contributor

I kinda answered it for myself here. I had to get the featurelayer off the jimumapview layerview and then set the layerview.layer.renderer and it worked

const viewMgr = MapViewManager.getInstance()
const jimuMapView = viewMgr.getJimuMapViewById(viewMgr.getAllJimuMapViewIds()[0])
const featureLayer = jimuMapView.jimuLayerViews[jimuMapView.mapWidgetId + '-' + featureLayerDs.id].layer

 

View solution in original post

0 Kudos
2 Replies
MarcBate
Frequent Contributor

I kinda answered it for myself here. I had to get the featurelayer off the jimumapview layerview and then set the layerview.layer.renderer and it worked

const viewMgr = MapViewManager.getInstance()
const jimuMapView = viewMgr.getJimuMapViewById(viewMgr.getAllJimuMapViewIds()[0])
const featureLayer = jimuMapView.jimuLayerViews[jimuMapView.mapWidgetId + '-' + featureLayerDs.id].layer

 

0 Kudos
JeffreyThompson2
MVP Regular Contributor

That method of grabbing the map view is a pretty neat trick. I took it and passed it into my initial state to solve a problem I was dealing with.

const viewManager = MapViewManager.getInstance()
const mapView = viewManager.getJimuMapViewById(viewManager.getAllJimuMapViewIds()[0])
const [jimuMapView, setJimuMapView] = useState<JimuMapView>(mapView)

GIS Developer
City of Arlington, Texas
0 Kudos