GriddleGriddle / Griddle

Simple Grid Component written in React
http://griddlegriddle.github.io/Griddle/
MIT License
2.5k stars 378 forks source link

Cannot Filter on Nested Data using LocalPlugin #847

Open archy-bold opened 5 years ago

archy-bold commented 5 years ago

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 commented 5 years ago

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.