how to get first column data when check on checkbox

how to get first column data when check on checkbox

SSR15SSR15 Posts: 1Questions: 1Answers: 0

i have use this but its getting last row data
$('#datatable2 tbody').on('click', 'input[type="checkbox"]', function () {
debugger;
if (this.checked) {
var trdat = $(this).closest('tr');

                $("#datatable2").DataTable().destroy();
                // $("#datatable2").DataTable().fnDestroy();
              var dataTable=$("#datatable2").dataTable({
                    //"aaData": JSON.parse(data.d),
                    //"data": data,
                    "columns": [
                             { 'data': 'LeadID' },
                              //{ 'data': 'LeadApp' },
                             //{ 'data': 'LeadType' },
                             { 'data': 'PhoneNumber' },
                             { 'data': 'CustomerName' },
                             { 'data': 'Address' },
                             { 'data': 'ElectricityBill' },
                             //{ 'data': 'Campaign' },
                             //{ 'data': 'State' },
                             //{ 'data': 'Postcode' },
                             { 'data': 'AppointmentDate' },
                             { 'data': 'AppointmentTime' },
                             { 'data': 'AliseName' },
                              {
                                  'data': 'QCRemarks',
                                  'enabled': false,
                                  'render': function (jsonData) {
                                      return '<textarea disabled rows="4" cols="25">' + jsonData + '</textarea>';
                                  }
                              },
                             //{ 'data': 'QC_status' },
                             {
                                 'data': null,
                                 'className': "center",
                                 'render': function (data, type, full, meta) {
                                     return '<input type="checkbox" name="id[]" value="'
                                        + $('<div/>').text(data).html() + '">';

                                 }

                             },

                    ]
                });
                //get the real row index, even if the table is sorted
              debugger;

              var index = dataTable.fnGetPosition(trdat[0]);
              var dataindex = dataTable.fnGetData(index)[0];
              alert(dataindex);
This discussion has been closed.