pwarelis / ajax-typeahead Goto Github PK
View Code? Open in Web Editor NEWModifications to the Bootstrap Typeahead plugin to add ajax capabilities
Modifications to the Bootstrap Typeahead plugin to add ajax capabilities
The README implies that the JSON-data is automagically-parsed into a usable format by your code.
I think a note to remind the user that they need to somehow ensure the data is JS (not just JSON) is in order.
ie: when I set my data-source to a Java-method that returned a JSON-string, the data presented by your code split each individual letter of the string into a unique value -- so, "[ "zoo" ]" would render as 3 different suggestions: 'z', 'o', and 'o'.
To fix that I had to use your preProcess(data)-method and return $.parseJSON( data )
No big deal to fix that, and I imagine there are use-cases where 'fixing' this would break those -- just might help to augment the documentation.
I installed this script on my application to use for on my fields, but I still needed the default bootstrap functionality which works off the source: property. Problem was that it stopped working after I installed this script.
I made a change to line 214:
From:
if (this.ajax.displayField) {
To:
if (typeof this.ajax != "undefined" && this.ajax.displayField) {
this.ajax seemed to be undefined and it was breaking the rest of the sorter function. Not sure if you want me to put in a pull request and fix it or if you can patch your code.
Apart from that, great job on the script!
Any thought or focus on having each of the typeahead elements cache their search results into a local cache of search values and results? This might speed up the UI if the object has a preloaded cache of common values, or simply keeps track of what it has shown the user.
If you use the ajax-parameters approach and don't explicitly define the triggerLength-value, it defaults to 1 not 3 (the documentation states it defaults to 3)
hi,
this looks very promising, but can you tell me how i apply this where i'm returning result as id:data pairs
e.g. for countries countryId & countryName. also where should i put argument for custom html styling, like in the original TypeAhead.js .
thanks for your time
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.