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

OnColumnResize DataGrid #2963

Merged
merged 3 commits into from
Mar 12, 2020
Merged

Conversation

jvince
Copy link
Contributor

@jvince jvince commented Mar 2, 2020

  • onColumnResize DataGrid prop
  • onColumnResize test
  • simple console log callback for datagrid example

Summary

Provide capability to be able to react when the DataGrid column size changes. Possible use case would be for example storing column widths into the local storage.

Checklist

  • Check against all themes for compatibility in both light and dark modes
  • Checked in mobile
  • Checked in IE11 and Firefox
  • Props have proper autodocs
  • Added documentation examples
  • Added or updated jest tests
  • Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

* onColumnResize DataGrid prop
* onColumnResize test
* simple console log callback for datagrid example
@kibanamachine
Copy link

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@cla-checker-service
Copy link

cla-checker-service bot commented Mar 2, 2020

💚 CLA has been signed

@chandlerprall
Copy link
Contributor

@jvince I've held off reviewing this as it was opened as a Draft; is this ready to be looked at?

@jvince
Copy link
Contributor Author

jvince commented Mar 7, 2020

@jvince I've held off reviewing this as it was opened as a Draft; is this ready to be looked at?

Yes, it is ready to be looked at. I would have a question:

I'm not sure if it's safe to call a callback function in setState callback. Should this be in a separate useEffect of useColumnWidths and do some diff state to find the changed column?

Is it enough to pass columnId and width on the column resize? interface

@jvince jvince marked this pull request as ready for review March 7, 2020 12:01
@chandlerprall chandlerprall self-requested a review March 9, 2020 19:59
@chandlerprall chandlerprall self-assigned this Mar 9, 2020
Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

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

One small request on a name, one question, and also:

Please add an entry to CHANGELOG.md, something like this existing entry:

  • Added isSortable props to EuiDataGridColumn and EuiDataGridSchemaDetector to mark them as un-sortable (#2952)

src/components/datagrid/data_grid_types.ts Outdated Show resolved Hide resolved
src/components/datagrid/data_grid.tsx Outdated Show resolved Hide resolved
* Renamed `EuiDataGridOnColumnResizeEvent` to `EuiDataGridOnColumnResizeHandler` for clarity
* Renamed `EuiDataGridColumnResizeEventData` to `EuiDataGridOnColumnResizeData` for clarity
* Removed useCallback `setColumnWidth`
Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

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

Changes LGTM; Pulled & tested locally

@snide
Copy link
Contributor

snide commented Mar 11, 2020

jenkins test this

@snide
Copy link
Contributor

snide commented Mar 11, 2020

Fixed CL conflict. Will merge on green. Thank you for the sub.

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_2963/

@chandlerprall
Copy link
Contributor

jenkins test this

Looks like a flaky unit test failed

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_2963/

@chandlerprall chandlerprall merged commit e769b3c into elastic:master Mar 12, 2020
@chandlerprall
Copy link
Contributor

Thanks @jvince !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants