Select style `os` and behaviour of checkbox

Select style `os` and behaviour of checkbox

ffeffe Posts: 28Questions: 4Answers: 0

Link to test case:
http://live.datatables.net/xixasusa/1/

Description of problem:
1. Select some rows, e.g. rows 1-4
2. Click on the checkbox of one of the selected rows, e.g. row 2

Current behaviour
Row 2 is selected

Expected behaviour:
Rows 1, 3, and 4 are selected

The behaviour of the checkbox is unexpected and feels unnatural. Windows Explorer behaves as expected.

Is it a technical limitation of the CSS pseudo element or could this be changed in future releases?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794

    Try the multi+shift option of select.style. Like this:
    http://live.datatables.net/xixasusa/2/edit

    Does that behave the way you like?

    Kevin

  • ffeffe Posts: 28Questions: 4Answers: 0

    Indeed, I did not know about the multi+shift option. I suppose I never checked the detail page of select.style you linked and but only the select page:

    Item selection can be performed by the end user in one of three different modes (...)

    I think this should be fixed :wink:

    Does that behave the way you like?

    Well, not really. multi+shift is a nice alternative, but I think os is the mode I would like to use.

    However, I think it conflicts with the behaviour users (at least me) expect when clicking on a checkbox. I would like to know your opinions about this aspect

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794

    IMO the os option behaves as I would expect and as you described:

    Description of problem:
    1. Select some rows, e.g. rows 1-4
    2. Click on the checkbox of one of the selected rows, e.g. row 2
    Current behaviour
    Row 2 is selected

    I don't use Windows but on the Mac the Explorer works as above :-) Also the docs for the os option describe this same behavior:

    provides complex behaviours such as ctrl/cmd clicking to select / deselect individual items, shift clicking to select ranges and an unmodified click to select a single item.

    What part of multi+shift does not behave as you like?

    Kevin

  • ffeffe Posts: 28Questions: 4Answers: 0

    I don't use Windows but on the Mac the Explorer works as above :-) Also the docs for the os option describe this same behavior:

    Yes, everything is correct in general, but I speak specifically about the checkbox. I have attached a video of my test case:

    What part of multi+shift does not behave as you like?

    I think that Canceling a selection is not as easy as with os

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794

    I have attached a video of my test case:

    Seems like the video is working as you suggested you want. You are selecting a range then clicking one row to unselect. Is that not what you want?

    Sorry if I'm missing an obvious issue.

    Kevin

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794

    I speak specifically about the checkbox

    Are you referring to the checkbox not being visible unless checked? That is not expected when using Datatables select checkboxes. If that is the problem you are trying to solve then its a styling issue. Please post a link to your page or a test case replicating the issue so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • ffeffe Posts: 28Questions: 4Answers: 0

    Seems like the video is working as you suggested you want. You are selecting a range then clicking one row to unselect. Is that not what you want?

    Yes, this is what I want, but unfortunately the video shows only Windows Explorer, not DataTables ;) Sorry I did not make this clear

    Are you referring to the checkbox not being visible unless checked? (...) If that is the problem you are trying to solve then its a styling issue.

    No, I just refer to functionality, not to styling.

    Please post a link to your page or a test case replicating the issue so we can help debug

    Test case is linked in the first post.

    Although I think it is described quite clear in Expected Result and Current Result, I will try to rephrase the problem:

    When clicking on a checkbox, it is not expected that other checkboxes are getting deselected.

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794

    So, the example I posted with multi+shift does not work for you? When I select multiple then just click one row that row becomes unselected with the others remaining selected.

    Kevin

  • ffeffe Posts: 28Questions: 4Answers: 0

    So, the example I posted with multi+shift does not work for you?

    It works (because in this mode a click by default adds/removes one row) and it is an alternative. But as I said, deselection does not work the same, for example. I would prefer to use os with this problem being fixed.

    The root problem with os is the following:

    When clicking on a checkbox, it is not expected that other checkboxes are getting deselected.

    I wonder what @allan thinks about it. Also I wanted to point him to my previous post where I described the outdated documentation before it gets lost.

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    When clicking on a checkbox, it is not expected that other checkboxes are getting deselected.

    Ctrl-click to deselect a single item without effecting others. This is how Finder in macOS and Explorer in Windows works as well. We've tried to model the os selection style of them.

    Allan

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    edited June 2021

    Thanks for the pointer about the list of selection types on the Select landing page. I've updated it in our repo and will deploy the fix soon.

    Allan

  • ffeffe Posts: 28Questions: 4Answers: 0

    Ctrl-click to deselect a single item without effecting others. This is how Finder in macOS and Explorer in Windows works as well. We've tried to model the os selection style of them.

    Yes and no. You are right about the row (or in general, the selector) but you are wrong about the checkbox.

    Please note that I talk about the checkbox. See my example about Windows Explorer in this post. In this example, file2.txt is deselected with a click without Ctrl or other modifying keys. I could not manage to find out how to enable checkboxes in Finder, so not sure about macOS

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    Answer ✓

    I see what you mean - yes. Thanks for the clarification - you are absolutely correct, we don't have a difference between the "checkbox" and full row selection like windows does (I'm quite certain that macOS doesn't have that ability).

    We treat the checkbox as just the same as the full row selection.

    I see the issue and agree there is a difference here due to how Windows is handling the checkbox. It isn't a behaviour we are going to change to match immediately, but I will review this and ask anyone else reading this and interested in this change to let us know.

    Thanks,
    Allan

  • ffeffe Posts: 28Questions: 4Answers: 0

    It isn't a behaviour we are going to change to match immediately, but I will review this and ask anyone else reading this and interested in this change to let us know.

    Thanks Allan. I agree this is a bit of an edge case, but it would be nice to have it fixed someday. Normal users just expect that checkboxes work the same in every application.

    For reference, the corresponding feature request for the checkboxes extension can be found here: https://github.com/gyrocode/jquery-datatables-checkboxes/issues/128

Sign In or Register to comment.