mui-x icon indicating copy to clipboard operation
mui-x copied to clipboard

[DataGrid] fix boolean `is` filter operator

Open cravindra opened this issue 1 year ago • 2 comments

  1. Update the is filter operator for boolean columns to filter for the false value correctly (previously, this would clear the filter). Continue support for string values to be backward compatible with how <GridFilterInputBoolean /> used to set the value.
  2. Update boolean filter values to be set as boolean values (null, true, false) instead of strings ("", "true", "false") by <GridFilterInputBoolean /> and stringify the initial value from the filter model to match the select options

This will now apply the filter and show the default filter menu on the toolbar/column value correctly for all these kind of values:

const filterModel = {
  items: [
    {
      field: 'isAdmin',
      operator: 'is',
      value: true, // true, "true", false, "false", null, undefined, ""
    },
  ],
};

Live Issue Demo can be used as a base to create a playground file to reproduce the bug/test the fix

Fixes #14076

Note:

The contribution doc (which redirects to the main MUI repo) recommends checking out next and raising PRs on to that. I tried doing that but realised the convention was to raise it on master based on recently merged PRs. Hope this works!

cravindra avatar Aug 18 '24 07:08 cravindra

Deploy preview: https://deploy-preview-14256--material-ui-x.netlify.app/

Generated by :no_entry_sign: dangerJS against 17dbbc278da4cead5053101e8b8f736225859eab

mui-bot avatar Aug 18 '24 07:08 mui-bot

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Oct 21 '24 23:10 github-actions[bot]

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Nov 04 '24 12:11 github-actions[bot]

This is fixed in https://github.com/mui/mui-x/pull/15252

cravindra avatar Nov 04 '24 21:11 cravindra