1239
| <![CDATA[<script>
$(document).ready(function() {
var dataTable = $('#dataTable').DataTable();
// Destrua a instância existente
dataTable.destroy();
$('#dataTable').DataTable({
dom: 'Plfrtip',
searchPanes: {
cascadePanes: true
},
ordering: false,
searchHighlight: true,
language: {
search: '', // Remover o texto do campo de busca
searchPlaceholder: 'Pesquisar'
},
initComplete: function() {
var table = this.api();
this.api().columns().every(function() {
var column = this;
if (column.index() !== 4) {
var searchInput = $('<input type="text" class="form-control form-control-sm" placeholder="Pesquisar...">')
.appendTo($(column.footer()).empty())
.on('keyup change clear', function() {
var searchTerm = this.value;
column.search(searchTerm, true, false, true).draw();
});
// Adicionar sugestões usando typeahead.js
if (column.index() === 4) {
$(searchInput).typeahead({
hint: true,
highlight: true,
minLength: 1
}, {
source: function(query, process) {
var data = table.column(column.index()).data().toArray();
process(data);
}
});
}
}
});
}
});
$("#dataTable_filter").hide();
});
</script>]]>
|