Запрос вашей помощи. В моей программе я загружаю данные таблицы из URL, используя вызовы ajax. После загрузки данных создается фильтр столбцов для каждого столбца, когда я ввожу текст в поле фильтра столбцов. данные фильтруются, а затем фильтр исчезает, поэтому вам нужна ваша помощь, чтобы избежать исчезновения фильтра столбца при вводе текста, ниже приведен код, который я пробовал
<script type="text/javascript">
$(document).ready(function(){
$("input[type='radio']").on('click', function(){
var rvalue = $("input[name='Servs']:checked").val();
var surl = '/Slist/' + rvalue;
var table = $("#Server").DataTable({
destroy: true,
ajax: {
url: surl,
dataSrc: "",
method: "GET",
xhrFields: { withCredentials: true }
},
columns: [
{ title: "Server", data: "Server", className: "text-center h8 px-0" },
{ title: "Location", data: "location", className: "text-center h8 px-0" },
{ title: "Rack", data: "rack", className: "text-center h8 px-0" }
],
filter: false,
searching: true,
initComplete: function () {
$('input[type=search]').val('');
$('#Server thead tr').clone(true).appendTo( '#Server thead' );
$('#Server thead tr:eq(1) th').each( function (i) {
var title = $(this).text();
$(this).html( '<input type="text" placeholder="'+title+'" />' );
$( 'input', this ).on( 'keyup change', function () {
if ( table.column(i).search() !== this.value ) {
table
.column(i)
.search( this.value )
.draw();
}
});
} );
}
});
});
});
</script>