Allow only one check box to be checked at a time

Allow only one check box to be checked at a time

shahbhavinkumarshahbhavinkumar Posts: 4Questions: 2Answers: 0

I am able to do it using the traditional method where I am defining my own check box, but I am relatively new with datatable js, is there any way to achieve it?

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    Hi @shahbhavinkumar ,

    Have you considered using the Select extension, as shown in this example, it will do that for you.

    If not, many @gyrocode 's Checkboxes will do it - here's an example.

    Cheers,

    Colin

  • shahbhavinkumarshahbhavinkumar Posts: 4Questions: 2Answers: 0

    That worked perfectly, I had used

            $('#example tbody').on('click', 'tr', function () {
                if ($(this).hasClass('selected')) {
                    $(this).removeClass('selected');
                }
                else {
                    table.$('tr.selected').removeClass('selected');
                    $(this).addClass('selected');
                }
            });
    

    This works also but knew there should be some sort of configuration

This discussion has been closed.