typeahead

twitter bootstrap typeahead 2.0.4 ajax error

回眸只為那壹抹淺笑 提交于 2020-01-21 06:06:49
问题 I have the following code which definitely returns a proper data result if I use the 2.0.0 version, but for some reason bootstrap's typeahead plugin is giving me an error. I pasted it below the code sample: <input id="test" type="text" /> $('#test').typeahead({ source: function(typeahead, query) { return $.post('/Profile/searchFor', { query: query }, function(data) { return typeahead.process(data); }); } }); When I run this example I'm getting a jQuery bug that says the following: ** item is

twitter bootstrap typeahead 2.0.4 ajax error

Deadly 提交于 2020-01-21 06:06:31
问题 I have the following code which definitely returns a proper data result if I use the 2.0.0 version, but for some reason bootstrap's typeahead plugin is giving me an error. I pasted it below the code sample: <input id="test" type="text" /> $('#test').typeahead({ source: function(typeahead, query) { return $.post('/Profile/searchFor', { query: query }, function(data) { return typeahead.process(data); }); } }); When I run this example I'm getting a jQuery bug that says the following: ** item is

typeahead bootstrap auto suggestion for ajax function

偶尔善良 提交于 2020-01-17 02:51:04
问题 I'm using typeahead auto suggestion for my application but the problem is ajax function exists in bookingAjaxFunc function and bookingAjaxFunc code is function bookingAjaxFunc(url, bookingId, jsonCall) { switch(jsonCall) { case 'Add': values = $('.booking-form').serializeArray(); break; case 'autoSuggestion': values = {bookingId: bookingId, jsonCall: jsonCall}; break; } $.ajax({ url: url, type: 'POST', dataType: 'json', data: values, cache: false, success: function(data) { switch(jsonCall) {

ember-cli typeahead causes errors inside ember.js

放肆的年华 提交于 2020-01-07 07:09:13
问题 installed type-ahead component from bower. and try to use {{type-ahead data=companies name="name" selection=selectedCompany}} component in action. it causes errors inside ember.js (_changeSingle and afterFunc functions) "Uncaught TypeError: Cannot read property 'selectedIndex' of undefined " Uncaught TypeError: Cannot read property 'nextSibling' of null is it for versions? 回答1: Here is my own typeahead ember component: Component App.XTypeaheadComponent = Ember.Component.extend({

Typeahead result formatting

萝らか妹 提交于 2020-01-05 08:29:46
问题 Trying to use Typeahead and struggling with JSON formatting (which I have no control over). { name="Long Island", type="2", id="1234"} Here is my JS $autocomplete.typeahead({ name: 'location', remote: { url: 'http://pathtomysite.com/%QUERY?', dataType: 'jsonp', filter: function (parsedResponse) { console.log(parsedResponse); return parsedResponse; } }, template: [ '<p class="repo-name">{{name}}</p>', '<p class="repo-description">{{id}}</p>' ].join(''), engine: Hogan }); So the request works

Adding HTML element after the dataset is brought in

守給你的承諾、 提交于 2020-01-04 12:47:21
问题 In Typeahead JS I'm trying to add an option that appears at the bottom of the dropdown after the user has started typing. Currently I'm using the 'onOpened' Custom Event to trigger adding some HTML after the 'tt-dropdown-menu' element is initialised. .on('typeahead:opened', onOpened) function onOpened($e) { $('.tt-dropdown-menu').html( "<a href="">Add Option</a>" ); } The problem is that the jQuery HTML is added when the dropdown is initialised, as expected, then when the user starts typing

Call Controller function from the directive in angular JS

ε祈祈猫儿з 提交于 2020-01-04 03:52:28
问题 I am using angular JS right now, in the i am using ui-bootstrap typeahead I am trying scroll on demand logic in typeahead i have tried this: HTML: <div class='container-fluid' ng-controller="TypeaheadCtrl"> <pre>Model: {{selected| json}}</pre> <input type="text" ng-model="selected" maxlength="5" typeahead="country.name for country in countries | filter:$viewValue | limitTo:8"> </div> JS: angular.module('plunker', ['ui.bootstrap']) .controller('TypeaheadCtrl', function ($scope) { $scope

Typeahead templating, if/else

孤街醉人 提交于 2020-01-03 05:45:08
问题 thanks for the help on this question: Typeahead result formatting, this is a follow up. My JSON looks like [{ name="Long Island", type="2", id="1234"}, { name="New York", type="1", id="5678"}] In the drop down list I need to be able to seperate type 1 from type 2, so Type 1 heading type 1 item type 1 item* Type 2 heading type 2 item type 2 item If there are no results for type 1, then don't show the heading. Same for type 2. Is this possible with typeahead and a templating engine? I'm using

Typeahead.js does give me suggestions but doesn't select them

安稳与你 提交于 2020-01-03 02:47:27
问题 I'm using Bootstrap 3.0 and the latest version of Typeahead.js with the Hogan engine. I managed to get the remote loading of the suggestions to work (finally). Now the next hurdle is when a user clicks on a suggestion, how do I make that the word filled in the input? I thought this was probably done automatically but it doesn't for some reason? Is this just a basic line of JS I'm missing? The input: <input class="form-control typeahead playername-search"> This is the JS: $(document).ready

Get selected items value for Bootstrap's typeahead

时间秒杀一切 提交于 2019-12-30 08:07:52
问题 Bootstrap just implemented a neat autocomplete feature called typeahead. I am having trouble getting the appropriate value for the text input. For instance, I might have the following: $('input').on('change', function(){ console.log($(this).val()); }); This does not appear to capture the selected value. Does anyone know how to get the selected value using typeahead with Bootstrap? 回答1: $('#autocomplete').on('typeahead:selected', function (e, datum) { console.log(datum); }); $('#autocomplete')