Ich versuche, mehr als 1 Suchfeld in einer Tabelle zu erstellen, aus der MySQL-Datenbank gefüllt. Dies ist ein gutes Beispiel: (https://datatables.net/examples/api/multi_filter.html), aber die Tabelle wird in HTML generiert.mehrere Suchoptionen in Mysql-Datenbank ausgefüllte Tabelle
Ich möchte auch Ajax implementieren und Timeout auf 1000s setzen. In diesem Moment kann ich die Tabelle gut sehen und 1 Suchoption funktioniert, aber wie Sie mehr hinzufügen? Hier
ist das, was ich bisher:
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.12/css/jquery.dataTables.css">
<script src="https://code.jquery.com/jquery-1.12.4.js" integrity="sha256-Qw82+bXyGq6MydymqBxNPYTaUXXq7c8v3CwiYwLLNXU=" crossorigin="anonymous"></script>
<script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
<script>
$(document).ready(function() {
// Setup - add a text input to each footer cell
$('#mainResults tfoot th').each(function() {
var title = $(this).text();
$(this).html('<input type="text" placeholder="Search '+denominacija+'" />, <input type="text" placeholder="Search '+stava+'" />');
});
// DataTable
setTimeout(function() {
$('#mainResults').load('branje_stevcev2.php');
setTimeout(function(){
var table = $('#mainResults').DataTable();
},1000);
}, 1000);
// Apply the search
table.columns().every(function() {
var that = this;
$('input', this.footer()).on('keyup change', function() {
if (that.search() !== this.value) {
that
.search(this.value)
.draw();
}
});
});
});
</script>
<table border='1' id="mainResults">
<td>
Nalagam ...</td>
</table>