Hi, I’m trying to reproduce the concept of associa...
# gooddata-ui
m
Hi, I’m trying to reproduce the concept of associative filters in GD.UI, selecting a value in a filters, only shows possible values in filter B. <AttributeFilter title=“Make” filter={filterMake} parentFilters={filterModel ? [filterModel] : []} parentFilterOverAttribute={idRef(“attr.re_all_secure.idrecord”)} onApply={(e) => updateFilter(“filterMake”, e)} /> <AttributeFilter title=“Model” filter={filterModel} parentFilters={filterMake ? [filterMake] : []} parentFilterOverAttribute={idRef(“attr.re_all_secure.idrecord”)} onApply={(e) => updateFilter(“filterModel”, e)} /> 1. select a model then filter make only show one value - GOOD 2. select a make then filter model shows possible values (filtered from make) - GOOD 3. Then select a model… both make and model filters are reset and filters are lost - BAD How can I work around this behaviour? Ideally, every field should narrow down possible values in all other filters.
m
Hello @Michael Serres. I'm not sure if I 100% understand your use case, here is an example of the "parent child filtering" if it helps: https://gdui-examples.herokuapp.com/attribute-filter-components/attribute-filter#parent-child-filtering Current behaviour (which is aligned with our Dashboards behaviour) is, that if you change selection of the parent filter, child filters are reseted and elements filtered. Preserving and filtering the selection of the child filters is officially not supported, however we are aware that this might not be ideal - e.g. in case of the drilling, so we are considering to change this behaviour in the future, however it's still in early phase, and there is no decision or plan for it yet. It should be possible to implement this with help of
@gooddata/sdk-backend-spi
backend.workspace(ws).attributes().forDisplayForm(df)
, and filtering the child filters selection by yourself. (It can be also challenging for multiple filters, because you need to ensure that they are filtered in the correct order, avoid the race conditions, etc). Does it answer your question?
m
Hi @Matyáš Kandl I’m not sure I follow the explanation. I’ve been using parent / child filters so I’m familiar with that part of the docs. The use case I’m after is simple: Filters components should only show values that are possible in the dataset, to avoid dead end “no data” in data exploration. My client won’t deploy live without this feature so I have to find a way to improve the experience. Can the filter behaviour be improved? Keen to hear how others resolved this as it seems a key feature of a BI tool.
m
@Michael Serres Please, can you add some video / screenshots or describe the issue more in detail?
m
Screen Recording 2022-12-06 at 14.41.17.mov
@Matyáš Kandl and this one start from child filter
Screen Recording 2022-12-06 at 14.44.12.mov