Using Bootstrap-3-Typeahead plugin performing the search based on what the user types and displayed information from another database column.
My server-side method performs the filter based on the services column and returns the name (colune name) of the stores as a result and is correct, that is, when Site or Informatica is informed the filter searches the Americanas test companies and Microsoft and others that I have as test, but not list as selection option.
In this other post: > Bootstrap-3-Typeahead does not list options Jorge showed me that it works simply but does not meet my demand.
Follow my code:
$("#pesquisa").typeahead({
source: function (query) {
return $.get("/Estabelecimento/GetDados", { q: query });
},
minLength: 3
});
Html
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="input-group">
<input type="text" id="pesquisa" name="pesquisa" class="form-control typeahead" autocomplete="off" placeholder="Pesquisar" />
<div class="input-group-btn"><button class="btn btn-primary">Pesquisar</button></div>
</div>
</div>
</div>
</div>
Return from my $ .get call when I search by site, it filters and brings the names below:
["Americanas", "Apple", "C & A", "Carrefour", "Microsfot", "Riachuelo", "Saraiva", "Sony"]