Havit.Blazor
Havit.Blazor copied to clipboard
[HxCheckbox] Tri-State feature request (indeterminate state)
Discussed in https://github.com/havit/Havit.Blazor/discussions/648
Originally posted by bluisanajmr November 6, 2023 It would be very useful if the checkbox or switch controls had a tri-state option. I am currently needing this to be used as the header in a HxGrid where one of the columns is a boolean. All of my grid headers allow searching but it isn't currently feasible to allow searching within a boolean column header with a switch or checkbox because that would force all records to be either True or False when initially displayed. Ideally, the user would be able to see all records and then choose to see only true or false records by clicking the checkbox or switch.
https://getbootstrap.com/docs/5.0/forms/checks-radios/#indeterminate
Currently available only via JavaScript (the :indeterminate
pseudo-class has to be applied).
Interesting,
I hadn't seen that version of a tri-state checkbox. I used it from the demo and it acted a little strangely. It started out in what I would call the null state and then when you clicked it, it became checked. You could then uncheck it but you couldn't get back to the null state without refreshing the page. Maybe that was just an issue with the demo but I would expect it to go to true when you check it, to false if you check it again and then null if you clicked it a 3rd time.
It started out in what I would call the null state and then when you clicked it, it became checked. You could then uncheck it but you couldn't get back to the null state without refreshing the page.
I think this is how it is meant (the demo). But we can provide different implementation.