Undefined for value in next page

Undefined for value in next page

anjibmananjibman Posts: 115Questions: 10Answers: 0

Hi All,

I am adding check box in one of the column in table after doing AJAX call on server. When I am trying to read value of all checked check boxes it is showing value for active page and for all other its showing undefined. What can be the issue?

Code snippet

$jq11(document).ready(function () {
  var selected = [];
  $jq11('#myTable').dataTable({
    "ajax": "/networkattorneys/cases/openCases.htm",
    "columns": [{ 
                "data": null,
                "render": function(data, type, row, meta) {
                    return '<center><input type="checkbox" id="' + data.dt_RowId + '" class="rmvChkBox" value="' + data.eventId + '"/></center>';
                }
            }
        ],
    "drawCallback": function( settings ) {
            $.each(selected, function(index, value){
                $('#'+value).attr("checked", "checked");
            });
        },
        "serverSide": true
});
$('.rmvChkBox').live("click", function() {
        var checkboxes = $("input[type='checkbox']");
        $('#removeButton').attr("disabled", !checkboxes.is(":checked"));
        var rowId = $(this).attr("id");
        var index = $.inArray(rowId, selected);
        if(index === -1) {
            selected.push(rowId);
        } else {
            selected.splice(index, 1);
        }
    });
    
    $('#removeButton').live("click", function() {
        $.each(selected, function(index, value){
            console.log($('#'+value).attr("value")); //display correct value for current page only. Undefined for other page.
        });
        
    });

Answers

This discussion has been closed.