1.10.2.Adding Auto-completion
public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/bundles/lib").Include( "~/Scripts/jquery-{version}.js", "~/Scripts/bootstrap.js", "~/Scripts/bootbox.js", "~/Scripts/respond.js", "~/Scripts/DataTables/jquery.datatables.js", "~/Scripts/DataTables/datatables.bootstrap.js", "~/Scripts/typeahead.bundle.js" ));@section Scripts { <script> $(document).ready(function () { var customers = new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'), queryTokenizer: Bloodhound.tokenizers.whitespace, remote: { url: '/api/customers?query=%QUERY', wildcard: '%QUERY' } }); $('#customer').typeahead({ minLength: 3, highlight: true }, { name: 'customers', display: 'name', source: customers }); }); </script> }<form> <div class = "form-group"> <label>Customer</label> <input id ="customer" type = "text" value="" class="form-control"> </div>
Last updated