-
-
Notifications
You must be signed in to change notification settings - Fork 78.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conveniently use objects in Typeahead #7298
Commits on Mar 16, 2013
-
Merge pull request #1 from twitter/3.0.0-wip
Use translucent box shadow on hr elements; colorize hr elements within a...
Configuration menu - View commit details
-
Copy full SHA for ab0a283 - Browse repository at this point
Copy the full SHA ab0a283View commit details -
Fix dropdown (and therefore typeahead) wrap
I have recently been experimenting with a lot of Typeahead controls, and I ran into a situation where my Typeahead was too wide for my screen, particularly on mobile devices, and it was not wrapping as I had expected it to do. http://jsfiddle.net/Mtxkn/4/ Changing the CSS for .dropdown-menu > li > a to white-space: normal causes it to wrap in every scenario that I have seen, whereas leaving it as nowrap never does what I want when the text is too long for a given item. It's possible that this has ramifications for other dropdown menus, but honestly I expect that even those would prefer to wrap than to extend the screen horizontally. If that is not the case, then it would work to change the typeahead version of this only: ```css .typeahead > li > a { white-space: normal; } ```
Configuration menu - View commit details
-
Copy full SHA for db8996a - Browse repository at this point
Copy the full SHA db8996aView commit details -
Flexibly support JSON object in Typeahead
http://jsfiddle.net/Mtxkn/11/ This adds the ability to conveniently override a lot more methods (ones that I arbitrarily identified as reasonable through my own usage), as well as providing an updated `sorter` method to interaction with objects. Further, by exposing each internal sorting step as a method, as well as the query values, each piece can be overridden to enable Typeahead to work with arbitrary data. The extra sorting option, `sortAny`, is added to support the case where the source gives results that may not match the actual query at all, such as through Ajax results that may have typo correction. Such cases would want to at least override `matcher`: ```javascript matcher: function() { return true } ``` That can be done without changes, but the sorting would have to be completely overridden in its current form even for simple, arbitrary object sorting. Allowing each step to be overridden enables arbitrary object support for both the `item` and the query due to the one-time expense of looking up the query in both normal and lowercase form; those methods could return anything relevant to the actual task at hand rather than a single string as well. Overriding `highlighter` will always be necessary to support JSON objects, but that is already exposed.
Configuration menu - View commit details
-
Copy full SHA for e1bc820 - Browse repository at this point
Copy the full SHA e1bc820View commit details -
Unit tests for object friendly sorting
Verifying details of sorting work as intended
Configuration menu - View commit details
-
Copy full SHA for 60904c0 - Browse repository at this point
Copy the full SHA 60904c0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5152f6c - Browse repository at this point
Copy the full SHA 5152f6cView commit details -
Configuration menu - View commit details
-
Copy full SHA for ded6297 - Browse repository at this point
Copy the full SHA ded6297View commit details -
Configuration menu - View commit details
-
Copy full SHA for e52dbd4 - Browse repository at this point
Copy the full SHA e52dbd4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2f489a3 - Browse repository at this point
Copy the full SHA 2f489a3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1ab7259 - Browse repository at this point
Copy the full SHA 1ab7259View commit details -
Configuration menu - View commit details
-
Copy full SHA for 74e0591 - Browse repository at this point
Copy the full SHA 74e0591View commit details -
Fixing sleepy mistake caught by unit test
Just goes to show why unit testing is so good. Catches stupid mistakes
Configuration menu - View commit details
-
Copy full SHA for 5c5d59c - Browse repository at this point
Copy the full SHA 5c5d59cView commit details -
Re-adding unit test for corrected code
Glad I did the test. Next time I'll have to set up the unit test environment locally so there isn't so much pull request spam.
Configuration menu - View commit details
-
Copy full SHA for f718caa - Browse repository at this point
Copy the full SHA f718caaView commit details -
Adding overridable behavior when showing menu
Enables simpler overriding of either just showing the menu (location) or changing behavior for `show` without effecting `showMenu`.
Configuration menu - View commit details
-
Copy full SHA for a345147 - Browse repository at this point
Copy the full SHA a345147View commit details
Commits on Apr 3, 2013
-
Fix return inconsistent return points
If the position is out of range, then it would simply `return` unlike all other `return`s in the function. This can at least break at line 201, as well as anyone overriding expecting a return. This change causes it to return `this` in all cases to avoid any unexpected exceptions.
Configuration menu - View commit details
-
Copy full SHA for cf5f40c - Browse repository at this point
Copy the full SHA cf5f40cView commit details