Radio button remains checked even after clicking a radio button on another page.

Radio button remains checked even after clicking a radio button on another page.

darshitj2darshitj2 Posts: 10Questions: 2Answers: 0

Hi All,

I have a general issue.
I have enabled pagination on my Data table with a radio button column in it. The scenario is i click a record on say page number 1 then i navigate to page number 5 and again click on some record (radio button). When i navigate back to page 1, i still see the record selected on page 1 (radio button checked). so how to manage this because the user can get confused that which record is selected at present.

@allan @rf1234 could you please help me with this.

Answers

  • rf1234rf1234 Posts: 3,036Questions: 88Answers: 423

    in case a new record gets selected with your radio button you could unselect the radio button in all other rows by looping through the table etc.
    https://datatables.net/reference/api/rows().every()

    table.rows().every( function ( rowIdx, tableLoop, rowLoop ) {
        var data = this.data();
        if (data.table.YourButton === 'whatever') {
            .... set it to a different value ...
        }
    });
    
This discussion has been closed.