-
Notifications
You must be signed in to change notification settings - Fork 80
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
Grid API for conditional selectability #4956
Comments
Should there be a tooltip / reason why the checkbox is disabled or should the checkbox not be rendered at all? |
I would expect that, in most use cases, the reasons for some items being disabled from selection would be fairly obvious from the context in which selection happens, and, even if it's not, the reason would probably be the same for all items, in which case a text somewhere adjacent to the Grid would serve better than per-item tooltips. We discussed whether the checkbox should be disabled or entirely hidden, but my hunch is that it's better to keep it visible but disabled so that users see that there is selection in the Grid, even if all none of the items currently in the viewport can be selected. There are also use cases where some items can be selected and disabled, i.e. un-deselectable, in which case we definitely need to show the checkbox. |
If there were a list of people in a grid, where users that did not have an email address or phone number could not be selected. Of course, these users could be filtered out from the grid, but lets assume that all users are in the grid. I would need to show why this role could not be selected. Having a note or footer text which states "users with no phone number or email can not be selected" is possible but it seems more user friendly to me that a tooltip for that unselectable row would be clearer to the user? The reason could be more complex per row as a calculation from the data for example, then the tooltip would have a more complex description also. |
I still think it should in most cases be obvious from the context why some items are not selectable. Let's say, e.g. that in your example you're selecting people to contact. You'd probably show the email and the phone number in the Grid, in addition to the person's name. The opposite – not showing those columns, and relying instead on a tooltip – would be pretty bad UX. And even in cases where you do need to explicitly explain why some items cannot be selected, I still think it would be better to have an always-visible message for it, rather than relying on users hovering the selection column (and pausing for a bit) to see it. I'm not saying that there could not be cases where the reason varies in complex ways for each item, and you still want to show all of those items in the Grid, but I struggle to imagine such a use case, and I'm still skeptical of a tooltip being a good solution for it. And if you really want to have a tooltip, you could use the regular Grid tooltip feature. So for now I'm keeping that outside of the scope of this feature. You could open a separate feature request ticket for a selection-column-specific tooltip generator feature, though. If it seems like a lot of people want it, we could add it later. |
Vote for: Use this feature request / question as example in the docs to show that it is possible with the regular tooltip feature of the Grid. That also comes with the added benefit that the tooltip is visible on the whole row - and not just the single column / disabled checkbox. |
@rolfsmeds I have a use case with a list of transactions in the grid and there are several ways that the transaction can be disabled for selection and the transaction data is used to calculate it differently for each row. So, in this case a reason for each row has to be on the row as a tooltip. I was not saying that a tooltip should be part of the task, just that the use case is not so uncommon. Until this new API is available: I use the partNameGenerator to style the row differently, and a tooltip for the whole row to explain why that row is disabled. The first-column-cell gets disabled in CSS using the various partNames. |
Description
An API in Grid for dynamically setting whether the user can select or deselect an item (row) in the Grid.
(Similar e.g. to PartNameGenerator and TooltipGenerator)
Use cases
As a user
I want to be able to select only those items that should be selectable
So that I can select valid items
Acceptance criteria
setItemSelectable(SerializableFunction<T,boolean> selectabilityFunction)
isItemSelectable
callback functionnonselectable-row
andnonselectable-row-cell
(precise naming of API is open for suggestions, the above is just a proposal)
General criteria
APIs reviewed
Performance (let's test!)
UX/DX tests in Alpha
Documentation: (to be added to Grid docs)
How to test?
Limitations:
Security
The text was updated successfully, but these errors were encountered: