Server Side table: column search only some fields
Server Side table: column search only some fields
Hi,
I have a server-side table
load the table
`var table = $('#canzoni_player').DataTable( {
"processing": true,
"serverSide": true,
"autoWidth": false,
"ajax": "scripts/tabella_playlist.php",
"lengthMenu": [[50,100, 250, 500, -1], [50,100, 250, 500, "Tutti"]],
"language": {
"url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Italian.json"
},`
load the search box for every columns
`
$('#canzoni_player tfoot th').each( function () {
var title = $(this).text();
$(this).html( '<input type="text" placeholder="Search '+title+'" />' );
} )
initComplete: function() {
var api = this.api();
// Apply the search
api.columns().every(function() {
var that = this;
$('input', this.footer()).on('keyup change', function() {
if (that.search() !== this.value) {
that
.search(this.value)
.draw();
}
});
});
}
;`
This is the html Code
` <tfoot>
<tr>
<th>Autore</th>
<th>Titolo</th>
<th>Seleziona</th>
<th>BPM</th>
<th>Anno</th>
<th>Player</th>
</tr>
</tfoot>`
But I want only some columns with the search box...
So it is possible?
thanks
Answers
This shows you what is being sent to the server for server side processing. https://datatables.net/manual/server-side#Sent-parameters
https://datatables.net/reference/option/columns.searchable
is probably what you are looking for.
Hi,
I found the solution with a custom html
Because it is server-side table
So in my css I set
display: none;