fnAddData returning the index, but is not getting added to the table
fnAddData returning the index, but is not getting added to the table
KarthikeyanS
Posts: 7Questions: 0Answers: 0
Hi,
I have a data table that displays a list of data, on click of an add button another data table is displayed in a pop over (a new jsp) from which rows can be selected and I am trying to add the selected rows to the main table using fnAddData( ), but it is not getting added and unfortunately not showing any error . However when I tried adding the same to the second table ( one within the pop over using this fnAddData ) it is working fine. I am not importing any js files in the pop over jsp, hence this issue is not due to overwriting the datatable js.
Does anyone have any idea why this weird behavior?
Thanks,
Karthikeyan
I have a data table that displays a list of data, on click of an add button another data table is displayed in a pop over (a new jsp) from which rows can be selected and I am trying to add the selected rows to the main table using fnAddData( ), but it is not getting added and unfortunately not showing any error . However when I tried adding the same to the second table ( one within the pop over using this fnAddData ) it is working fine. I am not importing any js files in the pop over jsp, hence this issue is not due to overwriting the datatable js.
Does anyone have any idea why this weird behavior?
Thanks,
Karthikeyan
This discussion has been closed.
Replies
Allan
I am using client side processing.
Thanks,
Karthikeyan
> can you link us to a test case or run the table through the debugger please.
Allan
loadAddExamDataPopupTable:function(result){
$('div.addExamPopupDiv').html(result);
// this is the second table that comes in the pop over
var AddExamTable = $('#add_exams_tbl').dataTable();
AddExamTable.$('tr').click(function () {
if($('input[name="exam_type_radio_check_name"]:checked').attr('id') == "inCert"){
certArray[rowCount] = oTable.fnGetData( this);
$(this).addClass('cert_type');
rowCount++;
}
} );
}
This array is send to another function (the below mentioned one) where it is loaded to another datatable.
loadExamRows: function(certArray){
if(($(clickedDiv).find('div[id ^= my_cert_div] table tbody tr').length) > 0){
var tableId= $(clickedDiv).find('div.my_cert table').attr('id');
$('#'+tableId).dataTable().fnAddData(certArray);
$('#'+tableId).dataTable().fnDraw();
}
}
When tried to debug the above code '$('#'+tableId).dataTable().fnAddData(certArray);' is returning the array representing the list of indexes but the data as such is not loaded in the table.
Thanks,
Karthikeyan