Typeahead with accentuation

1

I've created a small application that uses typeahead to do the searches. I have registered people with names with accentuation and to search them I need to write the absolute name (with accent). I need someone to be searched for, for example, the name "bliss" without having to add the accent on it. the code I'm using is as follows:

$.getJSON("{{ route('getRamaisJson') }}", function(data) {
				var jsonData = data;
				var dataSource = new Bloodhound({
					datumTokenizer: Bloodhound.tokenizers.obj.whitespace('id', 'nome', 'ramal', 'imagem_link', 'funcao', 'departamento', 'email', 'aniversario'),
					queryTokenizer: Bloodhound.tokenizers.whitespace,
					local: jsonData
				});

				dataSource.initialize();

				$('.typeahead').typeahead({
					minLength: 0,
					highlight: true
				}, {
					name: 'search-itens-list',
					// ao clicar em um resultado da busca o que vai ser adicionado no campo de pesquisa
					display: function(item){ return item.nome},
					source: dataSource.ttAdapter(),
					templates: {
						// se não houver resultados com base na busca exibir o seguinte template
						empty: ['<div class="empty">Nenhuma informação encontrada</div>'].join('\n'),
						suggestion: function (data) {

							feliz_niver = "";
							ramal = "";
							email = "";
							link = window.location.href + "/visualizar/" + data.id;

							if(data.ramal)
							{
								// formata o template dos itens que são exibidos na busca
								ramal = ' - <small><strong>Ramal:</strong> ' + data.ramal;
							}

							if(data.email)
							{
								// formata o template dos itens que são exibidos na busca
								email = '</small></p><p><strong>E-mail:</strong> ' + data.email;
							}

							if(data.aniversario)
							{
								// formata o template dos itens que são exibidos na busca
								feliz_niver = '<h5 style="color:#0273BD "><span class="glyphicon glyphicon-gift" aria-hidden="true" style="color:#318255" ></span> Feliz Aniversário!!!</h5>';
							}

							return '<ul><li><a href="' + link + '"<p><strong>Nome:</strong> ' + data.nome + ramal + email + '</p><p><strong>Departamento:</strong> ' + data.departamento + '</small></p>' + feliz_niver + '<img src="' + data.imagem_link + '" alt="' + data.nome + '"></li>';
						}
					}
				});
			});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

library: link

    
asked by anonymous 11.08.2017 / 15:51

0 answers