Is Editor required to get row data?
Is Editor required to get row data?
I'm brand new to DataTables. I have a functioning datatable that is displaying data from MySQL. I'd like to select a row in the table and be able to capture all of the row data so that I can edit it. I'm not sure if I have to purchase the Editor Extension to do so. My working script is below. I'm also trying to incorporate the second script below. Not sure how to merge the two to accomplish getting editing type functionality. Any guidance/assistance will be appreciated.
<script type="text/javascript">
$( document ).ready(function() {
$('#job_grid').DataTable({
dom: 'Bfrtip',
buttons: [
'selectedSingle'
],
"bProcessing": true,
select: 'single',
"serverSide": true,
"responsive": true,
"ajax":{
url :"response_jobs.php", // json datasource
type: "post", // type of method ,GET/POST/DELETE
error: function(){
$("#job_grid_processing").css("display","none");
}
}
});
});
</script>
<script type="text/javascript">
var table = $('#job_grid').DataTable();
$('#job_grid tbody').on( 'click', 'tr', function () {
console.log( table.row( this ).data() );
} );
</script>
This question has an accepted answers - jump to answer
Answers
You don't need Editor to do this.
You can use Select to perform the row selection (see its documentation for how to get the data for the selected row(s)).
Editor is a front end UI and API framework that provides the editing interface (it also has supporting PHP and .NET backend libraries). However, if you want to create your own UI for editing, you absolutely can do that! Editor just uses the publicly available DataTables API.
Allan