How to select radio buttons on all pages when data is loaded through ajax?

How to select radio buttons on all pages when data is loaded through ajax?

anujeetanujeet Posts: 39Questions: 15Answers: 0

I'm having a table with two columns "approve" and "disapprove"
User can click on approveAll. At that time all radio buttons in the table under "approve" column should get selected at all pages.

My data is being loaded through ajax.

Here is my code.

$( ".invoiceLineStatus" ).live( "click", function( event ) {
    var action = $(this).val();
    var invoiceLineId = '';

    action = action.toLowerCase().replace(/\b[a-z]/g, function(letter) {
        return letter.toUpperCase();
    });

    table.rows().every( function ( rowIdx, tableLoop, rowLoop ) {

        var data = this.data();
        var approved = data.approved;
        var disApproved = data.disapproved;

        if (action == 'Disapprove') {
            disApproved = $(disApproved);
            var id = disApproved.attr('id');
            if(typeof id != 'undefined') {
                $('#'+id).prop('checked', true);
            }

        } else {

            approved = $(approved);
            var id = approved.attr('id');
            if(typeof id != 'undefined') {
                $('#'+id).attr('checked', 'checked');
            }
        }

    });

});

What I'm doing wrong here?
Radio buttons for only first page are selected?

This discussion has been closed.