fnAddData returning the index, but is not getting added to the table

fnAddData returning the index, but is not getting added to the table

KarthikeyanSKarthikeyanS Posts: 7Questions: 0Answers: 0
edited July 2012 in Bug reports
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

Replies

  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin
    Are you using server-side processing? If not, then can you link us to a test case or run the table through the debugger please.

    Allan
  • KarthikeyanSKarthikeyanS Posts: 7Questions: 0Answers: 0
    Hi Allan,

    I am using client side processing.

    Thanks,
    Karthikeyan
  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin
    Okay - in that case the second part kicks in :-):

    > can you link us to a test case or run the table through the debugger please.

    Allan
  • KarthikeyanSKarthikeyanS Posts: 7Questions: 0Answers: 0
    The below function populates an array based on the click handler, using the fnGetData API
    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
  • KarthikeyanSKarthikeyanS Posts: 7Questions: 0Answers: 0
    I cannot share the entire code due to Intellectual Property Rights :(
This discussion has been closed.