Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AgGrid Person Cell - Custom generic filter feature #2163

Open
AndrejNikolicEq opened this issue Sep 4, 2024 · 0 comments
Open

AgGrid Person Cell - Custom generic filter feature #2163

AndrejNikolicEq opened this issue Sep 4, 2024 · 0 comments

Comments

@AndrejNikolicEq
Copy link
Contributor

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:

// filter
export const PersonFilter = {
  filter: 'agSetColumnFilter',
  filterParams: {
    applyMiniFilterWhileTyping: true,
    keyCreator: (params: KeyCreatorParams<ContractPersonnelRequest, ContractPerson>) => {
      return params.value?.azureId || '';
    },
    valueFormatter: (params: ValueFormatterParams<ContractPersonnelRequest, ContractPerson>) => {
      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
      ? `<a href="mailto:${person.mail}">${person.mail}</a>`
      : '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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant