hoist-react icon indicating copy to clipboard operation
hoist-react copied to clipboard

Specifying config for any field within `GridFilterModelConfig.fieldSpecs` requires all filterable cols to be spec'd

Open amcclain opened this issue 1 year ago • 0 comments

A grid with a number of cols marked as filterable:true enables filtering on all of those columns without any other GridModel config.

But if you need to e.g. provide a custom renderer for one of those columns and pass filterModel: {fieldSpecs: [{field: 'foo', renderer: fooRenderer()]} to GridModel, none of the other columns will be filterable, even if they are marked with filterable:true.

This is because GridFilterModel.parseFieldSpecs() is an all-or-nothing affair, and does not itself consult the grid columns at all: https://github.com/xh/hoist-react/blob/706fe9a902589c1f26bd2dfebf4050907a11fea3/cmp/grid/filter/GridFilterModel.ts#L147

We need to think it through carefully, but it seems to me that the filter model should also automatically include any fields for filterable columns that are not included in a provided fieldSpecs. Roughly analogous to how a grid will auto-define fields for all of its columns on a store it creates, even if given a store config with other / partial field defs

amcclain avatar Jul 26 '23 21:07 amcclain