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?
Solved! Go to Solution.
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
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
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)