Bug with select "multi+shift"

Bug with select "multi+shift"

itajackassitajackass Posts: 165Questions: 49Answers: 3

Hi, I think i've found a bug.

If I use "multi+shift" and I select a range for example of 3 rows (using SHIFT button), then if I want to reduce my selection to, for example 2 rows, with SHIFT pressed and clicking inside the checkbox, the checkbox became deselected but row still selected.

I've also create a video to explain better (it expires in 2 days sorry): https://streamable.com/kdttvp

Here the demo: https://live.datatables.net/tupojuro/1/edit

This question has an accepted answers - jump to answer

Answers

  • itajackassitajackass Posts: 165Questions: 49Answers: 3

    also i think there is another problem (not covered in my example):
    if I render an empty table, the checkbox in header for "selecting all rows" is not created (this maybe is ok....no rows... no option to select all of course).
    then, if I load rows trought ajax, the "select all checkbox" still not created... (bad, if I've got rows, the selectall checkbox is needed)

    it seems it is rendered only if table has at least 1 row during first rendering trought DOM.

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    @allan will need to look at the multi+shift issue.

    if I render an empty table, the checkbox in header for "selecting all rows" is not created

    This is a known issue. See Allan's lst comment in this thread for the workaround.

    Kevin

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Regarding the follow up point - that is a flaw in how I've set up how the checkbox column is detected. There is discussion and a workaround in this thread and I'm going to fix it, probably as part of the work for DT 2.1.

    There is definitely an error in the first part with the checkbox being unselected. What should be happening is that the row you click on will remain selected. Doing it in the first cell (but not the checkbox) will demonstrate what should be happening. Thanks for bringing this error to my attention.

    Allan

  • itajackassitajackass Posts: 165Questions: 49Answers: 3

    OK thanks.
    Other finds:

    1) Using a way to disable singles row to be selected using for example a class "selectableRow", clicking outside the single checkbox is ok (no selection permitted). But clicking inside the single checkbox, the checkbox became selected, but row is not highlight (the final result is that row is not selected (CORRECT) but checkbox selected cause confusion to final user).

    select: {
        style: 'multi+shift',
        selector: 'tr.selectableRow td:not(:first-child)'
    },
    

    2) "Select all" inside the header still ignore filter "selectableRow" and select all rows, also the tr without class "selectableRow"

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    "Select all" inside the header still ignore filter "selectableRow" and select all rows, also the tr without class "selectableRow"

    I'm not surprised by that one. All rows are selectable via the API, but you are using the selector option to limit the end user ability to select a row. I don't consider that one a bug. Use user-select if you want a row to be unselectable.

    There is definitely a checkbox error though with the other one. Thanks!

    Allan

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    That was one of the more frustrating bugs, but that's a fix committed :)

    Thanks again for the reports,
    Allan

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    I should say that the lack of a header checkbox when no data in the table is still present. That's something yet to be fixed.

  • itajackassitajackass Posts: 165Questions: 49Answers: 3

    Hi, is there a way to include latest updates from this page? https://datatables.net/download/

    Actually Select is still 2.0.1 version

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Yes, you can use the nightly build. The query parameter is just to make sure you get the latest version - it is cached.

    Allan

  • itajackassitajackass Posts: 165Questions: 49Answers: 3

    Thanks. In the step 3 of download page i use the "Download" tab to get a unique "datatable.js" of ALL what i need (all plugins merged). Can I append nightly build to this one JS or is better that I include all js (and css) for each component?

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Yes, you could append the Select nightly to it (probably best to remove the existing Select code from the file that you already have, rather than defining it twice - odd things might happen!).

    Allan

Sign In or Register to comment.