-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
docs(cdk\drag-drop): Add table drag drop example #28969
docs(cdk\drag-drop): Add table drag drop example #28969
Conversation
94f4ae2
to
bb1c375
Compare
Deployed dev-app for bc612dc to: https://ng-dev-previews-comp--pr-angular-components-28969-dev-80lb1mz4.web.app Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR, I left a few comments but overall it looks good.
<ng-container matColumnDef="position" sticky> | ||
<mat-header-cell *matHeaderCellDef> No. </mat-header-cell> | ||
<mat-cell *matCellDef="let element"> | ||
<mat-icon class="example-drag-cursor" (mousedown)="dragDisabled = false;">reorder</mat-icon> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is dragging disabled initially? When I was trying it out, it felt a bit buggy because it wouldn't start dragging the first time. I think that we should just remove the dragDisabled
binding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to enable dragging only when the user clicks the drag icon, but I see verry laggy. I'll just remove it.
cursor: move; | ||
} | ||
|
||
.cdk-drag-preview { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a background color to this one? Currently it's transparent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'll add it.
src/cdk/drag-drop/drag-drop.md
Outdated
Adding `cdkDropList` on the `mat-table` element and the `cdkDrag` on the `mat-row` element groups the rows into a | ||
reorderable collection. Rows will automatically rearrange as an element moves. You need to | ||
listen to the `cdkDropListDropped` event to update the data model once the user finishes dragging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This describes how the drag&drop works in general. I think we can just say something about how drag&drop can be integrated into a table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this sound?
"Angular Material provides seamless integration of drag-and-drop functionality into tables, by adding the cdkDropList
directive to your mat-table and handling the (cdkDropListDropped)
event, you can enable drag-and-drop interactions within your table. This allows users to reorder rows or perform other custom actions with ease."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good
d79ef43
to
bc612dc
Compare
Adds an example that shows how to drag and drop table rows Fixes angular#25168
bc612dc
to
d58b39d
Compare
Adds an example that shows how to drag and drop table rows (cherry picked from commit 26aa8fa)
Adds an example that shows how to drag and drop table rows (cherry picked from commit 26aa8fa)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Adds an example that shows how to drag and drop table rows Fixes #25168