Applying filter in DataGrid Material UI

37 Views Asked by At

I am trying to apply filter to the column in DataGrid. I need to get input and then set the value to filter according to it but for now I am trying to apply default filtering. I got many examples using the filterModel as same as I did but now the columnField property is not being recognized.

<DataGrid
          rows={rows}
          getRowId={(row) => row.txnId}
          columns={columns}
          filterModel={{
            items: [
              {
                columnField: 'vendorName',
                operatorValue: 'contains',
                value:"dd"
              }
            ]
          }}
/>

Error: Object literal may only specify known properties, and 'columnField' does not exist in type 'GridFilterItem'.ts(2353)

1

There are 1 best solutions below

1
Utsab Shrestha On

I found out that newer version of material ui have property

{
  field: 'vendorName',
  operator: 'contains',
  value:"dd"
}