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 OnCellClick and allow restricting selection to checkboxes #2160

Closed
wants to merge 11 commits into from

Conversation

hksalessio
Copy link
Contributor

@hksalessio hksalessio commented Jun 6, 2024

Pull Request

📖 Description

This PR adds an OnCellClick functionality to FluentDataGrid and allows restricting the selection of rows to the checkboxes of the select column.

🎫 Issues

This PR should allow for implementing the features requested in #2130 and #1952 (comment).

👩‍💻 Reviewer Notes

Since I renamed FluentDataGridCell.GridColumn to FluentDataGridCell.ColumnIndex (because I think this is more fitting), this PR technically contains a breaking change. If you don't want this change, I will revert it.

✅ Checklist

General

  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

Component-specific

  • I have added a new component
  • I have added Unit Tests for my new compontent
  • I have modified an existing component
  • I have validated the Unit Tests for an existing component

@vnbaaij
Copy link
Collaborator

vnbaaij commented Jun 6, 2024

Yeah, you definitely need to revert the renaming first. We use that name because it is also used in the web component and we want to keep that (logical) link

Copy link
Collaborator

@vnbaaij vnbaaij left a comment

Choose a reason for hiding this comment

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

Revert GridColumn name change

@dvoituron
Copy link
Collaborator

Could you add some unit tests to FluentDataGridColumSelectTests to validate the new RestrictToCheckbox attribute?

@hksalessio
Copy link
Contributor Author

Could you add some unit tests to FluentDataGridColumSelectTests to validate the new RestrictToCheckbox attribute?

I added some 👍

@dvoituron
Copy link
Collaborator

An UI issue occurs when I change the RestrictToCheckbox property

peek

@dvoituron
Copy link
Collaborator

The OnRowClick should be raised in all cases: it's correct when RestrictToCheckbox is unchecked.
But is not correct when RestrictToCheckbox is checked.

peek

@hksalessio
Copy link
Contributor Author

hksalessio commented Jun 7, 2024

The OnRowClick should be raised in all cases: it's correct when RestrictToCheckbox is unchecked. But is not correct when RestrictToCheckbox is checked.

The problem with this is that I would not see any way to implement #2130 since the row click is always triggered after the cell click. When clicking the checkbox, the clicked row would be selected but if OnRowClick is executed afterwards to deselect all other rows, the previous selection would be cleared (of course, this only applies to multi select mode).

@dvoituron
Copy link
Collaborator

If OnRowClick is executed afterwards to deselect all other rows, the previous selection would be cleared (of course, this only applies to multi select mode).

Yes, that was my initial question. I haven't analyzed the problem. But it would be better to have this event in any case. If not, we'll get some "feedback" :-) I can look at it in a few days if you like, see if I have another idea.

@hksalessio
Copy link
Contributor Author

Maybe we could add a new parameter StopClickPropagation or PreventRowClick to columns?

@dvoituron
Copy link
Collaborator

Maybe we could add a new parameter StopClickPropagation or PreventRowClick to columns?

No. That's not ideal. We should find a solution to do that automatically.

@hksalessio
Copy link
Contributor Author

I can look at it in a few days if you like, see if I have another idea.

Hi, any news on this? 😅

@dvoituron
Copy link
Collaborator

Hi, any news on this?

I haven't had time yet :-(

@vnbaaij vnbaaij added this to the v4.8.1 milestone Jun 17, 2024
@franklupo
Copy link
Contributor

Normally you select only from the checkbox. the current behavior is not correct. If you want something different you use the envents on the row.

@franklupo
Copy link
Contributor

for #2130 the solution is in the event. Call deselect all and select the current row.

@hksalessio
Copy link
Contributor Author

Normally you select only from the checkbox. the current behavior is not correct. If you want something different you use the envents on the row.

I definitely agree with you. However, this could be considered a breaking change by the repository owners.

@franklupo
Copy link
Contributor

Normally you select only from the checkbox. the current behavior is not correct. If you want something different you use the envents on the row.

I definitely agree with you. However, this could be considered a breaking change by the repository owners.

the solution might be to create a new selection column that behaves correctly.

@dvoituron
Copy link
Collaborator

dvoituron commented Jun 24, 2024

⚠️ @hksalessio @vnbaaij I created this new PR: #2252
Give me your feedbacks

@vnbaaij
Copy link
Collaborator

vnbaaij commented Jun 24, 2024

Other PR LGTM. Merged it and think we can close this one.

@dvoituron dvoituron closed this Jun 24, 2024
@hksalessio
Copy link
Contributor Author

⚠️ @hksalessio @vnbaaij I created this new PR: #2252 Give me your feedbacks

Looks good to me, thank you!

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