equinor / equinor/fusion-react-components

AgGrid Person Cell - Custom generic filter feature

Open
#2,163 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
9
Forks
5
Avg merge
4d 3h
Merged PRs (30d)
52

Description

**Is your feature request related to a problem? Please describe.**
Currently, when you use AgGridPesonCell with data extraction, default filter is not working correctly,
so you have to add custom filter in order to access correct data to filter. Here is working example:

``` tsx
// filter
export const PersonFilter = {
filter: 'agSetColumnFilter',
filterParams: {
applyMiniFilterWhileTyping: true,
keyCreator: (params: KeyCreatorParams) => {
return params.value?.azureId || '';
},
valueFormatter: (params: ValueFormatterParams) => {
return params.value ? params.value.name : '(Blanks)';
},
} as ISetFilterParams,
};

// usage of person filter in person cell
agGridPersonCell({
field: 'person',
headerName: 'Person',
flex: 1,
azureId: (data: Person) => data.azureId,
heading: (person) => person.name,
subHeading: (person) => {
return person.mail
? `${person.mail}`
: 'email not available';
},
dataToSort: (data: Person) => data.name,
...PersonFilter,
}),
```

**Describe the solution you'd like**
We should maybe write generic property like for sorting, where you can choose data to use to filter and data to format

**Describe alternatives you've considered**
Do nothing, leave it as is

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.