0

I have a datatable with ajax data.and in one column with input values.user can update the values in textbox. now my problem is i want to get the only updated textbox values not all inputs in datatble? how can i achieve this...i am new to the jquery datatables..please ca anyone help me...

var table = $('#tbl_AttendanceTracking').DataTable();

var value = table.cell(0, 13).nodes().to$().find('input').val();

var allRows = $("#tbl_AttendanceTracking").dataTable().fnGetNodes();

i have tried above code..but it giving first roew....

thank you guys...i found a solution from here Catch change event on input field dynamically added to Jquery Datatables table

  • Please provide the code for the table. it is not clear what you want to achieve. – Aaron May 16 '19 at 05:13
  • thank you guys for your reply....i found a solution for this from this link https://stackoverflow.com/questions/16225336/catch-change-event-on-input-field-dynamically-added-to-jquery-datatables-table – narendra May 16 '19 at 06:22

2 Answers2

0

Try this, Even you can choose according to your requirement.

var table = $('#tbl_AttendanceTracking').DataTable();

$('#tbl_AttendanceTracking tbody').on( 'click', 'tr', function () {
    console.log(table.row( this ).data() ); // Row Data
    console.log(table.cell( this ).data() );// Cell Data


} );

DataTables Cell Data

Atul Jain
  • 1,035
  • 2
  • 16
  • 24
  • that will give row data...but i want only column input values which are updated by the user on a button click . – narendra May 16 '19 at 05:55
0

I guess jQuery Datatable doesn't provide any option to keep a track on edited tables.

But it does provide events like preEdit/postEdit for any customization.

So may be you can write your own logic to store all rows(by index) which are being edited.

This links might help

Inline Editing

Other option is to get cell click event like this

$('#example tbody').on( 'click', 'td', function () {
    alert( table.cell( this ).data() );
    // your logic here
} );
MyTwoCents
  • 7,284
  • 3
  • 24
  • 52