-
Notifications
You must be signed in to change notification settings - Fork 377
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] Multiselect feature, adding a SelectColumn
#1952
Conversation
✅ All tests passed successfully Details on your Workflow / Core Tests page. |
Summary - Unit Tests Code CoverageSummary
CoverageMicrosoft.FluentUI.AspNetCore.Components - 56.2%
|
SelectRowColumn
SelectColumn
Love this! Would probably be good to store the selected state of rows centrally, for example in the |
Finally!! Looking great! Always been using some ugly workarounds to get similar behavior. Could you maybe add the option for an checkbox in the header? Like maybe a parameter |
Columns and attributes already updated As far as storing the selected state is concerned, this could be an additional feature, but it would probably cause a lot of problems. For example, when using the virtualization function, I'm not sure that all "previous" items are stored in this internal memory. |
On the same remark, adding a checkbox in the header seems like a good thing if we have all the data in memory. But we could add this option and an EventCallback to allow the developer to select all the elements. About Single/Multiple, yes that will be done :-) |
@vnbaaij @hksalessio I renamed to these attributes: Example SelectAllChanged="@(all => people.ToList().ForEach(p => p.Selected = (all == true)))" |
…oft/fluentui-blazor into users/datagrid/multi-select
Nice work @dvoituron thank u for creating this feature. |
That's not the case in Windows Explorer, for example |
so we could not have it even with CSS ? |
and one more suggestion is very important please if you haven't done it already! when the user click the row I mean anywhere on the it should select not only click on exactly the checkbox. |
Already done and included in the GIF above :-) |
Will this feature be released any time soon? |
added to milestone v4.7.2 |
What if I want to only Select item on Checkbox rather than Full row? Is there a way to do it? SOme of my columns contain custom data and DATA that user has @OnClick on them.. Trying to solve it? |
Today, this is not possible. Unless you create your own "SelectColumn" using a |
I am kind of working on a pull request that could solve this problem. Shoud be ready for review later today. |
Do you use manual management via |
Ok I see, thanks for your reply. Is there a way to somehow stop triggering Grid refresh on any 'onclick' event that triggers it? I have noticed it also happens if I add a button to TemplateColumn, once I clicked on a button first time - it reloads the data. Any consequent clicks don't do it. |
We can't change that on our side. You could optimize on your side and determine is the reload is necessary. |
[DataGrid] Multiselect feature, adding a
SelectColumn
There are two ways of managing this
SelectColumn
.Items
and letting the grid manage the selected rows entirely, viaSelectedItems
. property.Or by manually managing the way selected lines are saved, via
Property
,OnSelect
andSelectAll
.This requires more configuration but is probably more interesting when using
Virtualize
or when directly managing a customIsSelected
property.Property
: Function to be executed to display the checked/unchecked icon, depending of you data model.OnSelect
: Action to be executed when the row is selected or unselected.SelectAll
: Value indicating whether the [All] checkbox is selected.These example are using a class containing:
Example
Unit Tests