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

Admin Generator (Future): Add initialFilter prop for grids #2927

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

andrearutrecht
Copy link
Contributor

@andrearutrecht andrearutrecht commented Dec 13, 2024

Description

initialFilter can be used to preset a filter for a grid. This parallels the functionality of initialSort.

The linkOperator is optional and defaults to "Or".

Be sure to use MUI grid operator values to ensure correct display in FilterPanel.

TODO:

  • Show value of initialFilter in FilterPanel -> GQL filter operator was used instead of MUI filter operator

Acceptance criteria

  • I have verified if my change requires an example: <!-- Unit test | Demo | Development story | No example needed --->
  • I have verified if my change requires a changeset
  • I have verified if my change requires screenshots/screencasts

Example

export const ProductsGrid: GridConfig<GQLProduct> = {
    {...},
    initialFilter: {
        items: [
            { columnField: "type", operatorValue: "is", value: "Shirt" },
            { columnField: "price", operatorValue: ">=", value: "10" }
        ],
        linkOperator: "and",
    },
    {...},

Screenshots/screencasts

Updated screencast:

Screen.Recording.2024-12-13.at.11.41.49.mp4

The following screencast includes behaviour when using the wrong type of filter operator:

Screen.Recording.2024-12-13.at.10.27.26.mp4

Further information

@andrearutrecht andrearutrecht self-assigned this Dec 13, 2024
@andrearutrecht andrearutrecht force-pushed the admin-generator-grid-initial-filter branch from a731f31 to 0a4293d Compare December 13, 2024 10:45
@andrearutrecht andrearutrecht marked this pull request as ready for review December 13, 2024 10:45
Copy link

sonarcloud bot commented Dec 13, 2024

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

Successfully merging this pull request may close these issues.

1 participant