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

[DataGrid] Add a feature to fit multiple column's width to their content #731

Merged
merged 2 commits into from
Dec 19, 2024

Conversation

i-aki-y
Copy link
Contributor

@i-aki-y i-aki-y commented Dec 7, 2024

When I double-click the selected multiple column headers, I want to enable the multiple column widths to be fitted at once.

The version for the single column is implemented in #546.
In this PR, I extend this to support multiple visible columns.

I restricted resizing to the visible columns because of performance limitations. On my local machine, resizing a single column of trillion rows took 800 [ms]. So, resizing millions of columns will take hundreds of hours.

In my use case, I do not want to fit all columns. The goal is to display some columns of interest on one screen and compare their contents with minimum horizontal scrolling, so with this restriction, this feature makes enough practical sense.

The behavior of this implementation is as follows:

  • When we double-click one of the selected column headers, resize all visible chosen columns.
  • When we double-click the column header outside the selection, resize only the clicked column.
  • When no columns are selected, resize only the clicked column.

This PR does not include a test code because I could not figure out how to implement the test code in such a case.
(ex, simulating a double click event at a specific header edge in a data-grid)
If there is any examples which I can refer, let me know and I will check them out.

@krassowski krassowski added the enhancement New feature or request label Dec 7, 2024
Copy link
Member

@krassowski krassowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, thank you @i-aki-y!

@krassowski krassowski merged commit e696f5d into jupyterlab:main Dec 19, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants