You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/10/01 09:46:28 UTC

[GitHub] [incubator-superset] codepic edited a comment on issue #11113: State is undefined in dashboardFilters.js

codepic edited a comment on issue #11113:
URL: https://github.com/apache/incubator-superset/issues/11113#issuecomment-702018399


   @villebro I managed to get the filtering working :+1: 
   
   ![image](https://user-images.githubusercontent.com/3933589/94787043-0bbec800-03d2-11eb-82a9-53c8b193b5e2.png)
   
   Below are the relevant changes I needed to do in `superset-frontend`
   
   ![image](https://user-images.githubusercontent.com/3933589/94787383-88ea3d00-03d2-11eb-803e-a36faf1fe6cb.png)
   
   As it seems, the check `form_data.viz_type === 'filter_box'` is hard coded so I added my `viz_type` to the check and my plugin started emitting filter events correctly.
   
   There's a catch. If I add `filter_box` into the dashboard, the functionality breaks and the table only listens to the filters set in the `filter_box` plugin.
   
   However this is not an issue as I can still use multiple custom plugins which emit filters and they seem to be working as expected:
   
   ![image](https://user-images.githubusercontent.com/3933589/94789617-6a397580-03d5-11eb-9907-308230c0d4d4.png)
   
   Since hard coding `viz_type` check is not optimal, I would suggest we would add a flag to the `form_data` when ever a plugin developer adds the `FilterBoxItemControl` into their control panel. Then we can check in `dashboardState.js` and `getInitialState.js` that if this flag is set to `true`.
   
   This way plugin developers could start implementing their own filters just by adding `FilterBoxItemControl` into their `controlPanel.ts` and using the `hooks` provided by superset.
   
   Table plugin would also benefit from this as it currently emits any clicked fields as filters but by adding the `FilterBoxItemControl` into the control panel, user could gain more granular control over the filtering. E.g. which fields to filter by, can you select multiple, etc.
   
   As it currently stands, having custom filtering functionality is impossible with Superset without modifying `superset-frontend` yourself and the table plugin's Emit Filter Events -functionality goes to show that.
   
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org