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

Add auto-resize function for column widths #221

Merged
merged 8 commits into from Aug 19, 2021

Conversation

ibdafna
Copy link
Member

@ibdafna ibdafna commented Aug 18, 2021

This PR adds a function which resizes column widths for body and row column headers (index and non-index columns) based on the text width of their column names. This allows users to not have to worry about manually resizing the grid columns upon instantiation or pre-determine column widths before instantiation. The API is quite simple takes two optional arguments:

DataGrid.fitColumnNames(area: DataGrid.ColumnFitType = 'all', numCols?: number): void;

type ColumnFitType = 'all' | 'row-header' | 'body';

numCols allow for capping of the number of columns to be resized.

lumino_autofit

Signed-off-by: Itay Dafna <i.b.dafna@gmail.com>
Signed-off-by: Itay Dafna <i.b.dafna@gmail.com>
Signed-off-by: Itay Dafna <i.b.dafna@gmail.com>
Signed-off-by: Itay Dafna <i.b.dafna@gmail.com>
Signed-off-by: Itay Dafna <i.b.dafna@gmail.com>
Signed-off-by: Itay Dafna <i.b.dafna@gmail.com>
Signed-off-by: Itay Dafna <i.b.dafna@gmail.com>
Signed-off-by: Itay Dafna <i.b.dafna@gmail.com>
Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

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

Thank you!

@blink1073 blink1073 merged commit b87ceab into jupyterlab:master Aug 19, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants