Home > Article > Web Front-end > Instructions on how to use DataTables to obtain row data of specified elements.
Method 1:
Use jquey to get, var row = $('.edit').parent().parent();
Disadvantage: can only get things on the dom , cannot obtain non-rendered data
Method 2:
First bind the line number to the element
$('#example'"columns""data":"name", "orderable": , "searchable": ,"render" : '<button id="btnEdit" data-rowindex="'+meta.row+'">编辑</button>'
Then Get the row number based on the element
var rowIndex = $('#btnEdit').attr('data-rowindex');
Finally get the data
$('# userTable').DataTable().rows(rowIndex).data()[0];
The above is the detailed content of Instructions on how to use DataTables to obtain row data of specified elements.. For more information, please follow other related articles on the PHP Chinese website!