-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[data grid] Export columns that I am not seeing #15349
Comments
Would it make sense to hide the columns you don't need? As you already mentioned you cannot delete columns with Would having that functionality (deleting columns) fix your use case? related issue: #15296 |
Thanks for the help. I don't want to hide them, as the client could see the columns, the idea is to be able to just add the columns to export and delete them at the end of the process. |
On the other hand I would like to understand why if we have a setColumnVisibilityModel, why we don't have a getColumnVisibilityModel, it would be very useful, wouldn't it? So I don't have to have a variable to control that value, or is there a way to get the model? |
There are three ways to get the currently visible columns:
const visibilityModel = useGridSelector(apiRef, gridColumnVisibilityModelSelector);
const visibilityModel = apiRef.current.state.columns.columnVisibilityModel |
This is tricky as the @arminmeh any idea how this could be achieved? |
I was thinking maybe state restore could work, but it does not clear new columns as well We can extend Alternatively, to be more aligned with the rows API, we can add thoughts @mui/xgrid? |
@93carlosmesa How about hiding the columns and including them in the CSV export by passing the Is this what you're looking for? |
The issue has been inactive for 7 days and has been automatically closed. |
The problem in depth
I need to export some columns that I don't have in the dataGrid, so what I do is to update the columns, export the data and then the idea is to have the same dataGrid again, so I save the columns previously. But the function updateColumns adds elements but does not delete them because I understand that it modifies the columns that we have with the corresponding data.
The only step I can't get with gridApiRef React.MutableRefObject is to put back the columns from the beginning. There is no function to delete columns or remove columns.
Your environment
`npx @mui/envinfo`
System:
OS: macOS 14.6.1
Binaries:
Node: 18.19.1 - ~/.nvm/versions/node/v18.19.1/bin/node
npm: 10.2.4 - ~/.nvm/versions/node/v18.19.1/bin/npm
pnpm: Not Found
Browsers:
Chrome: 130.0.6723.117
Edge: 130.0.2849.80
Safari: 17.6
npmPackages:
@emotion/react: ^11.13.0 => 11.13.0
@emotion/styled: ^11.13.0 => 11.13.0
@mui/base: ^5.0.0-beta.40 => 5.0.0-dev.20240529-082515-213b5e33ab
@mui/core-downloads-tracker: 5.16.6
@mui/icons-material: ^5.16.6 => 5.16.6
@mui/lab: ^5.0.0-alpha.173 => 5.0.0-alpha.173
@mui/material: ^5.16.6 => 5.16.6
@mui/private-theming: 5.16.6
@mui/styled-engine: 5.16.6
@mui/styled-engine-sc: ^6.0.0-alpha.18 => 6.0.0-dev.20240529-082515-213b5e33ab
@mui/styles: ^5.16.6 => 5.16.6
@mui/system: ^5.16.6 => 5.16.6
@mui/types: 7.2.15
@mui/utils: 6.1.4
@mui/x-data-grid: 7.22.0
@mui/x-data-grid-generator: ^7.22.0 => 7.22.0
@mui/x-data-grid-premium: ^7.22.0 => 7.22.0
@mui/x-data-grid-pro: ^7.22.0 => 7.22.0
@mui/x-date-pickers: ^7.22.0 => 7.22.0
@mui/x-internals: 7.21.0
@mui/x-license: 7.21.0
@mui/x-license-pro: ^6.10.2 => 6.10.2
@types/react: ^18.3.3 => 18.3.3
react: 18.3.1 => 18.3.1
react-dom: 18.3.1 => 18.3.1
styled-components: ^6.1.12 => 6.1.12
typescript: ^5.6.3 => 5.6.3
Search keywords: DataGridPro update column
Order ID: #1061-3100
The text was updated successfully, but these errors were encountered: