Custom filters don't work with ajax.data. Json created by django-datatables-views
Custom filters don't work with ajax.data. Json created by django-datatables-views
I use djando-datatables-view in order to create the json data.
My data is displayed fine. Sorting works either. I created additional <input> to search data only in the second column of my table. When I'm writing something in 'search-input-text' i can see the processing modal but table rows aren't filtered at all.
I can't find any information about how to do custom filters with ajax.data. I am a newbie and I've been spending three days to find the solution. Please. help:) My code:
$(document).ready(function() {
var dataTable = $('#datatabletest').DataTable({
"processing": true,
"serverSide": true,
"ajax":{
"url" :"http://...tojson",
"type" : "get",
error: function(){ // error handling
$(".datatabletest-error").html("");
$("#datatabletest").append('<tbody class="datatabletest-error"><tr><th colspan="3">ERROOOOR</th></tr></tbody>');
$("#datatabletest_processing").css("display","none");
}
}
});
$("#datatabletest_filter").css("display","none");
$('.search-input-text').on( 'keyup', function () {
var i =$(this).attr('data-column');
var v =$(this).val();
dataTable.columns(i).search(v).draw();
} );
});