Problem with Selection of radio buttons in Datatables.
Problem with Selection of radio buttons in Datatables.
I am working with the pagination and we are selecting the record based on the selection of radio button.
Problem: Datatable is acting like making user to select multiple radio buttons (not in single page).
Process: I have selected the radio button in first page and moved to the second page and again selected the radio button but the first selected radio button still get selected in first page. It should not be.
Below code is for making json object to Array Code :
$.each(
dataFromJSON,
function(i, key) {
var resultRow = [];
fileCount++ ;
var radioSelection = "<label for=\"selectedRegistrationNumber"+fileCount+"\" class=\"displayNone\">Selected Registration </label><input type=\"radio\" path=\"selectedRegistrationNumber\" id=\"selectedRegistrationNumber"+fileCount+"\" name=\"selectedRegistrationNumber\" title=\'select "+key.FacilityName+"\' value=\'"+key.registrationNumber+"\' />";
var address = '';
if (key.addressLine2 != ''
&& key.addressLine2 != null
&& key.addressLine2 != "null") {
address = key.addressLine1 + " "
+ key.addressLine2 + ", " + key.city
+ ", " + key.zip + ", " + key.country;
} else {
address = key.addressLine1
+ ", "
+ key.city
+ ", "
+ (key.stateId == undefined ? ''
: key.stateId) + " " + key.zip
+ ", " + key.country;
}
resultRow.push(radioSelection);
resultRow.push(key.FacilityName);
resultRow.push(address);
result.push(resultRow);
});
return result;
Below code defines an array to datatable my making the data as arr
// DataTable
var table = $('#ffrmFacilitiesTable')
.DataTable(
{
"processing" : true,
"serverSide" : false,
"data" : arr,
"deferRender" : true,
order : [ [ 1, 'desc' ] ],
"columns" : [ {
"class" : "breakWordsWhole",
"orderable" : false,
"searchable" : false
}, {
"class" : "breakWordsWhole"
}, {
"class" : "breakWordsWhole"
} ],
"oLanguage" : {
"sSearch" : "Filter: ",
"sEmptyTable" : "<fmt:message key='dlm.SubAccount.FFRMRegistration.displayOnlyDomesticFacilitiesMessage' />"
},
'fnDrawCallback': function(row, data, dataIndex) {
//i have an small idea using this method it could happen, but how it could be disabled
previous selected radio button in previous page.
});
},
});
I hope above code explains my problem. Please help me how we could do using fnDrawCallback method.