I need to filter the datatable object for that i am using datatable jquery. But its not working
I am using laravel 5.6 version , I added a new blade for my datatable filter. but its not filtering the datatable results.
I am getting the datatable result through AJAX. Needed a solution for filtering.
ajax blade code:
<div class="container-fluid page-body-wrapper">
<div class="main-panel">
<div class="content-wrapper">
<div class="card">
<div class="card-body">
<h4 class="card-title">Data table</h4>
<div class="row">
<div class="col-12">
<div class="table-responsive">
<table id="order-listing" class="table">
<thead>
<tr>
<th>Name</th>
<th>Quantity</th>
<th>Price</th>
<th>SKU</th>
<th>Weight</th>
<th>Status</th>
<th>Seller Price</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach ($result as $data)
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>
<a class="btn btn-primary" href="">Edit</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- content-wrapper ends -->
</div>
<!-- main-panel ends -->
</div>
jquery code:
(function($) {
'use strict';
$(function() {
$('#order-listing').DataTable({
"aLengthMenu": [
[5, 10, 15, -1],
[5, 10, 15, "All"]
],
"iDisplayLength": 10,
"language": {
search: ""
}
});
$('#order-listing').each(function() {
var datatable = $(this);
// SEARCH - Add the placeholder for Search and Turn this into in-line form control
var search_input = datatable.closest('.dataTables_wrapper').find('div[id$=_filter] input');
search_input.attr('placeholder', 'Search');
search_input.removeClass('form-control-sm');
// LENGTH - Inline-Form control
var length_sel = datatable.closest('.dataTables_wrapper').find('div[id$=_length] select');
length_sel.removeClass('form-control-sm');
});
});
})(jQuery);
I expect the output with filtered datatable.
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2Aig8Gi
via IFTTT
Aucun commentaire:
Enregistrer un commentaire