Skip to content
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

Get and Set 'Datagrid density and row height' #7275

Closed
GenatHadri opened this issue Oct 10, 2023 · 1 comment
Closed

Get and Set 'Datagrid density and row height' #7275

GenatHadri opened this issue Oct 10, 2023 · 1 comment
Labels
answered Issues answered by the EUI team - auto-closes open issues in 7 days if no follow-up response question

Comments

@GenatHadri
Copy link

Hello everyone,

I hope you're all doing well. I'm seeking help with the Datagrid component, specifically regarding the toolbarVisibility properties: Density and RowHeight, both of which are set to true. My goal is to find a way to store their values somewhere and, when I render the datagrid, to check if these values have been specified. If they have, I'd like to display the table based on those settings. If not, I'd like to use the default values.

Is there a possible way to achieve this? How can I get and set the values for these properties? Below, you'll find an image of these options for reference:

Image

@cee-chen
Copy link
Member

cee-chen commented Oct 10, 2023

The gridStyle.onChange and rowHeightsOptions.onChange props are the callbacks you'll need use to get the current datagrid density or row height settings (fired whenever the user changes said settings). Take a look at the Demo JS tab of the below example:

https://eui.elastic.co/#/tabular-content/data-grid-style-display#adjusting-your-grid-to-usertoolbar-changes

@cee-chen cee-chen added the answered Issues answered by the EUI team - auto-closes open issues in 7 days if no follow-up response label Oct 10, 2023
@github-actions github-actions bot removed the answered Issues answered by the EUI team - auto-closes open issues in 7 days if no follow-up response label Oct 11, 2023
@cee-chen cee-chen added the answered Issues answered by the EUI team - auto-closes open issues in 7 days if no follow-up response label Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered Issues answered by the EUI team - auto-closes open issues in 7 days if no follow-up response question
Projects
None yet
Development

No branches or pull requests

2 participants