Editing Datatable
Editing Datatable
sowmister
Posts: 1Questions: 1Answers: 0
Hi,
I have a column in my datatable which is an edit icon. Onclick of that icon i wanted to retrieve the row and send a server call.
$('#department tbody').on('click', 'td.details-control', function () {
var rowIndex = table.fnGetPosition( $(this).closest('tr')[0] );
} );
Instead of rowIndex I need the departmentId which is in 3rd column of the dataTable.
Is there a way to do that?
This discussion has been closed.
Answers
Using the new API you would do something like
table.row( $(this).closest('tr') ).data()
to get the row data and then access column 3 data either as an array or an object, depending on how you configure the table.If you need to use the legacy API then fnGetData will get the row's data from the closest tr.
Allan