skip to Main Content

I’m using mui datagrid component in my react project and want to add filters of ‘>’ and ‘<‘. I couldn’t figure out from the documentation. Is there a prop in DataGrid for this?

P.S. I am new to material ui and am using the free version.

2

Answers


  1. Chosen as BEST ANSWER

    So instead of creating a new filter, I just changed the column type to 'number', and it automatically provided the number filters like '>', '<', '=', etc. I found out that the default type for columns is 'string'. Here is the link to Column Definitions. Scroll down to find different column types. https://mui.com/x/react-data-grid/column-definition/#column-types


  2. There is a prop that you can pass on to the column definition like when you are declaring your columns and it is same like field, renderCell, and it is called filterOperators.
    Following link will help you more to dig on this matter
    https://mui.com/x/react-data-grid/filtering/customization/#customize-the-operators

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search