How to avoid multiple radio buttons selection when paginating a table

How to avoid multiple radio buttons selection when paginating a table

bruno_casarottibruno_casarotti Posts: 1Questions: 0Answers: 0
edited April 2014 in DataTables 1.9
Hello guys,

I'm having a problem here:
When I select a radion button in a page 1 and another one in the same page it works fine, but when I select a radio button in the page number 2, and go back to the page number 1, that first radio button still selected and the one in the page number 2 is also selected, how can I solve this problem? I was looking for a solution here in the forum but couldn't find someone with the same problem.

Here is my simple code:
(sorry, I couldn't host my example in live.datatables.net, not even on JS Fiddle)

[code]
$(document).ready(function () {
var oTable = $('#example').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers"
});
});

[/code]

Replies

  • vinaybvkvinaybvk Posts: 3Questions: 0Answers: 0
    edited April 2014
    You can achieve this by adding fnDrawCallback in your datatable initialization. fnDrawCallback will be called every time when the table is redrawn there you can clear the first pages selected radio button and can even keep any conditions if needed for doing that uncheck. Below is the example:

    [code]
    $(document).ready(function () {
    var oTable = $('#example').dataTable({
    "bJQueryUI": true,
    "sPaginationType": "full_numbers",
    "fnDrawCallback": function(oSettings) {
    $(".<>").prop('checked', false);
    }
    });
    });
    [/code]

    I don't know if this is the correct way of doing this or not. But it will work.
This discussion has been closed.