How to add more custom filters in datatables request?
How to add more custom filters in datatables request?
mstdmstd
Posts: 4Questions: 2Answers: 0
in my laravel 8 app with jquery 3.4/bootstrap 4.6 I use dataTable 1.10.19
and I try to add more custom filters and when user enter in search input:
@section('footerscripts')
<script src="{!!admin_assets!!}/plugins/custom/datatables/datatables.bundle.js"></script>
<script>
var oTable= null
$(document).ready(function () {
initEducations()
...
function initEducations() {
var filter_education_category_id = $("#filter_education_category_id").val()
var filter_document_type = $("#filter_document_type").val()
var url= 'educations_filter/1/'+filter_education_category_id + '/'+filter_document_type
oTable = $('#tzdatatables').dataTable({
"language": {
"emptyTable": "No educations found"
},
"bServerSide": true,
"sAjaxSource": url,
"bProcessing": true,
"aoColumns": [{
"mData": 0 // Sr No
}, {
"sWidth": "30%",
"mData": 1 // Name
}, {
"mData": 2 // Status label
}, {
"mData": 3 // Education category
}, {
"mData": 4 // $created_at_formatted
}, {
But it does not work as if filter_education_category_id selected it is not applied to filter.
How can I do it?
Answers
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin