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

Allow enabling/disabling multi row selection in eds-data-grid #3355

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/eds-data-grid-react/src/EdsDataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function EdsDataGrid<T>({
columnResizeMode,
pageSize,
rowSelection,
multiRowSelection,
selectedRows,
enableColumnFiltering,
debug,
Expand Down Expand Up @@ -227,6 +228,7 @@ export function EdsDataGrid<T>({
debugHeaders: debug,
debugColumns: debug,
enableRowSelection: rowSelection ?? false,
enableMultiRowSelection: multiRowSelection,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would recommend using the same property name as the library.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's reasonable - I wrote it like this to match the syntax of enableRowSelection

Copy link
Contributor

Choose a reason for hiding this comment

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

@torleifhalseth The enable prefix was added to make it clearer what the prop does. I'd argue that prefixing enableMultiRowSelection as well makes sense, given this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

have we concluded on this? Is there any further work needed or can i merge this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Imo we can leave it as is, since it matches the pattern for enableRowselection already in place.

enableColumnPinning: true,
enablePinning: true,
getRowId,
Expand Down
7 changes: 7 additions & 0 deletions packages/eds-data-grid-react/src/EdsDataGridProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ type BaseProps<T> = {
* @default false
*/
rowSelection?: boolean | ((row: Row<T>) => boolean)
/**
* Only used if row selection has been enabled via `rowSelection`
* Enables/disables multiple row selection for all rows in the table OR
* A function that given a row, returns whether to enable/disable multiple row selection for that row's children/grandchildren
* @default true
*/
multiRowSelection?: boolean | ((row: Row<T>) => boolean)
/**
* Callback for when row-selection changes
*/
Expand Down
Loading