Griddle icon indicating copy to clipboard operation
Griddle copied to clipboard

Cannot Filter on Nested Data using LocalPlugin

Open archy-bold opened this issue 5 years ago • 1 comments

Griddle version

1.13.1

Expected Behavior

Entering a query in the filter box which matches a nested field should return the row with that data.

Actual Behavior

Entering a query in the filter box which matches a nested field returns no results.

Steps to reproduce

Run the storybook and browse to the 'with nested column data' story. Enter 'hawaii' in the filter, observe there are no results.

Pull request with failing test or storybook story with issue

Can be reproduced from the storybook.

Edit: it appears this last worked in v1.11.2

archy-bold avatar Feb 01 '19 13:02 archy-bold

So having delved into this a little, it appears the reason for this is that rather than allow filtering on all base (non-nested) columns except those with fllterable set to false, it now ignores any column, without ColumnDefinition set. ie if a column isn't defined in the ColumnDefinitions it's not filtered on at all.

A workaround is to define your nested property as a non-visible column, so it's included in the list of columns to filter. This performs toString() on the nested Map or List object, exposing all the properties.

<ColumnDefinition id="location" visible={false} />

It doesn't feel like starting with the base properties and then filtering those based on the columnProperties is the right way round, especially considering this will mean all nested properties will be ignored.

archy-bold avatar Feb 01 '19 14:02 archy-bold