bootstrap-typeahead

bootstrap typeahead not populating with response from promise

[亡魂溺海] 提交于 2021-02-19 06:24:10
问题 My bootstrap typeahead is as following: <input id="inputId" type="text" ng-model="selected" typeahead="name for name in getSuggestions($viewValue) " typeahead-on-select="typeaheadOnSelect($item)" ng-trim="false"> The getSuggestions() return a promise,like following: $scope.getSuggestions = viewValue => { let deferred = $q.defer(); getSuggestions(viewValue).then(words => { deferred.resolve(words); // array of strings }) .catch(()=>{ deferred.reject([]); }); return deferred.promise; }; NOTE :

Unable to set focus on an input of Twitter Bootstrap's Typeahead

蓝咒 提交于 2021-02-07 11:32:32
问题 When I remove these attributes: data-source="<?=str_replace('"', '"', json_encode($equipment, JSON_HEX_TAG | JSON_HEX_APOS)); ?>" data-items="4" data-provide="typeahead" I am able to perform this: $(document).ready(function() { $('.first').focus(); }); This is my HTML markup for this: <div class="itemx"> <input type="text" class="input-large first" autocomplete="off" placeholder="Equipment Name/Label" name="equip[]" data-source="<?=str_replace('"', '"', json_encode($equipment, JSON_HEX_TAG |

Clearing inputText using react-bootstrap-typeahead when invalid data is entered

非 Y 不嫁゛ 提交于 2021-01-27 20:02:19
问题 I'm trying to validate a selection using react-bootstrap-typeahead and clear out the input text if invalid when I move to another area of the page. I can't figure out a good way to do this. The onBlur for the Typeahead component doesn't fire at the right time to validate and clear. Any suggestions would be appreciated Here is my typeahead definition <Typeahead bsSize="sm" defaultSelected = {this.props.options.slice(selectedIndex)} clearButton labelKey="roomNumber" options={this.props.options}

Update JSON on every keyup for twitter typeahead

不羁岁月 提交于 2020-01-27 08:29:05
问题 I have a html page with an input field. Every time something is typed in this field, there is a call done to a php script with jQuery. This php script returns a JSON with the results of a particular query based on the input field. This works fine and I am logging the output in console . <html> <head> <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> <script> var r = jQuery(function($) { $('#name').keyup(function() { var input = $('#name').val(); var response = $.getJSON(

Twitter bootstrap Typeahead to populate hrefs

浪子不回头ぞ 提交于 2020-01-25 07:39:05
问题 I'm using the bootstrap typeahead, with an ajax call, to create a kind of instant search for my website. It's all working great, apart from the fact that Typeahead appears only to be able to process the titles and not the hrefs. Example: My PHP code is this: $results = mysql_query("MY SELECT QUERY GOES HERE"); $array = array(); while ($row = mysql_fetch_assoc($results)){ $array[] = $row['title']; } echo json_encode($array); And my Javascript is here: $('#quickSearch').typeahead({ source:

Bootstrap Typeahead click event

狂风中的少年 提交于 2020-01-24 13:33:06
问题 I'm using bootstrap-typeahead.js v2.0.0 for an autocomplete search. I have a click event to view the result but it only works like 1 of 10 times, in the other case I get an error: "Uncaught SyntaxError: Unexpected token u". I've looked around and found this: https://github.com/twitter/bootstrap/issues/4018 and I tried the solutions there but nothing seems to work. It works perfect when I use the enter-key so it has to be something concerning the click-event. Anyone else got the same problem?

typeahead.js onselect item redirect to new window

徘徊边缘 提交于 2020-01-23 07:10:37
问题 I am use remote url with json response ( New typeahead.js) my javascript : $(document).ready(function() { $('input.country').typeahead({ valueKey: 'name', remote : { url : 'example.in/d.php?query=%QUERY', filter: function (parsedResponse) { var dataset = []; for (i = 0; i < parsedResponse.length; i++) { dataset.push({ name: parsedResponse[i].name }); } if (parsedResponse.length == 0) { dataset.push({ name: "No results" }); } return dataset; }, }, });; }) my json response : [{"name":"Nokia 110

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

Bootstrap Typeahead with AJAX source: not returning array as expected

微笑、不失礼 提交于 2020-01-04 04:30:07
问题 I am having a lot of trouble getting bootstraps typeahead to work properly with an AJAX source. If I alert out the array that is being returned it is perfectly fine, even when I hard code it to test it. It seems to return nothing most of the time or only a few items from the array when you have typed in a near match. Here is what I have at the moment: $('#companyNameInput').typeahead({ source: function(query, process){ $.ajax({ url: ROOT+'Record/checkCompanyName', async: false, data: 'q='