Reputation: 806
my website contain basic CRUD operation with ajax build in, my question is, how to implement datatable? by the way, I already deploy yajra datatable
js file
$(function () {
$('#example').DataTable({
});});
function manageRow(data) {
var rows = '';
$.each( data, function( key, value ) {
rows = rows + '<tr>';
rows = rows + '<td>'+value.title+'</td>';
rows = rows + '<td>'+value.description+'</td>';
rows = rows + '<td data-id="'+value.id+'">';
rows = rows + '<button data-toggle="modal" data-target="#edit-item" class="btn btn-primary edit-item">Edit</button> ';
rows = rows + '<button class="btn btn-danger remove-item">Delete</button>';
rows = rows + '</td>';
rows = rows + '</tr>';
});
$("tbody").html(rows);}
view
<table id="example" class="display" cellspacing="1" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
</tr>
</thead>
<tbody>
</tbody></table>
Upvotes: 0
Views: 1085
Reputation: 1230
The documentation is really straightforward, if you follow the example it should work. https://datatables.yajrabox.com/eloquent/basic
Upvotes: 1
Reputation: 130
I think StackOverflow is not the place to right the application for you. If you have special questions on that, I can help you.
Upvotes: 1