'How to get filtered values from MUI datagrid

Is it possible to get values from mui DataGrid?

I have a table and i want to have a custom export based on user filter and columns that are hidden or displayed but i need these filtered values. There is any way to get this from DataGrid?



Solution 1:[1]

The prop onSelectionModelChange gives you the IDs of the selected cells, and then you can filter them based on your requirements to export the selected ones.

 <DataGridPro
  onSelectionModelChange={(props)=>{
            console.log(props);
          }}
  />

Solution 2:[2]

You may want to use the gridFilteredSortedRowIdsSelector Most of the useful seletors for exporting are defined in the "Exported rows" section

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hameez Rizwan
Solution 2 Alexandre Fauquette