Add checkbox in first column

Add checkbox in first column

jigar311982jigar311982 Posts: 70Questions: 31Answers: 0

Hello,

I am adding row with AJAX request, i want first column should have checkbox with value is ID of data,
My table initialization is like below,

$(document).ready( function () { $('#managerlist').DataTable( { stateSave: true, "dom": 'C<"clear">lfrtip', "columns": [ { "data": "manager_id" }, { "data": "manager_firstname" }, { "data": "manager_lastname" }, { "data": "manager_email" }, { "data": "manager_gender" } ] } ); });

and my jquery for adding row as below,-------------

$("#manform").submit(function(event)
{
event.preventDefault();
$("#LoadingImage").show();
$.ajax({
type: "POST",
url: "<?php echo base_url(); ?>index.php/admin/administration/add_manager",
data: $("#manform").serialize(),
success: function(message)
{
$("#LoadingImage").hide();
$('#manform')[0].reset();
var objData = jQuery.parseJSON(message);
var table = $('#managerlist').DataTable();

                        var rowNode = table.row.add( {
                                        "manager_id": objData.manager_id,
                                        "manager_firstname":       objData.manager_firstname,
                                        "manager_lastname":   objData.manager_lastname,
                                        "manager_email":     objData.manager_email,
                                        "manager_gender": objData.manager_gender,
                                        } )
                                        .draw()
                                        .node();

                                        $( rowNode )
                                            .css( 'color', 'red' )
                                            .animate( { color: 'black' } );

                    }   
                    });
        }); 

my HTML table have first TD like this,

<td><input type="checkbox" name="select_manager" value="<?php echo $manager["manager_id"];?>" /></td>

Once i refresh PAGE, i can get checkbox, but how can i get with row.add() function?

At this moment, i can get ID number if first column, but i want checkbox visible in first column with its value as ""manager_id": objData.manager_id,", how can i add this?

Thanks,

This discussion has been closed.