Write a accent word and send a without accent.
Write a accent word and send a without accent.
wilsonrneto
Posts: 6Questions: 1Answers: 0
Hi all,
Is there a way to override the default search field method?
My idea is when I write a word with accent sent to ajax a search string without accents using the default search field.
I use http://next.datatables.net/plug-ins/filtering/type-based/accent-neutralise for a custom search. Works fine.
My DT v1.10.4 and JQ v1.11.1
var oTable = $('#tabela').DataTable({
"processing": true,
"serverSide": true,
"ajax":
{
"type": "POST",
"url": "qry/qry_licitacoes_emandamento_com_itens.asp",
"data" : { "periodo": <%=periodo%> }
},
"columns": [
{
"class": "details-control",
"orderable": false,
"data": null,
"defaultContent": ""
},
{ "data": "edital",
"title": "Edital:",
"render": function ( data, type, row ) {
return "<a href=\"licitacoes_detalhes.asp?ident="+ row[6] +"&acompanhamento=true\">"+ data +"</a>";
}
},
{ "data": "objeto", "title": "Objeto:" },
{ "data": "status", "title": "Situação:" },
{ "data": "rp", "visible": false },
{ "data": "tipo_edital", "visible": false },
{ "data": "id_edital", "visible": false },
{ "data": "id_modalidade", "visible": false },
{ "data": "id_status", "visible": false },
{ "data": "modalidade", "visible": false }
],
"orderCellsTop": true,
"pagingType": "simple_numbers",
"language": { "url": "css/dataTables/traducao_pt_BR.txt" },
"order": [[1, 'asc']],
initComplete: function () {
var api = this.api();
// colunas
var colEdital = api.column( 1 );
var colSituacao = api.column( 3 );
var colModalidade = api.column( 9 );
$("#fEdital").on( 'change', function () { colEdital.search( jQuery.fn.DataTable.ext.type.search.string( $(this).val() ) ).draw(); } );
$("#fSituacao").on( 'change', function () { colSituacao.search( jQuery.fn.DataTable.ext.type.search.string( $(this).val() ) ).draw(); } );
colSituacao.data().unique().sort().each( function ( d, j ) {
$("#fSituacao").append( '<option value="'+d+'">'+d+'</option>' )
} );
colModalidade.data().unique().sort().each( function ( d, j ) {
$("#fEdital").append( '<option value="'+d+'">'+d+'</option>' )
} );
}
});
I tryed to do something like this: (doesn't work)
$(".dataTables_filter input")
.unbind() // Unbind previous default bindings
.bind("input", function(e) { // Bind our desired behavior
if(this.value == "") {
oTable.search("").draw();
} else{
oTable.search( jQuery.fn.DataTable.ext.type.search.string( this.value ) ).draw();
}
return;
});
Best regards,
Wilson Rocha
This discussion has been closed.