Live data from Hacker News

Make Better Select Boxes with Chosen

harvesthq.github.com

41–50 of 89 posts

Re: Make Better Select Boxes with Chosen

#44
post #29

We've been using this for what feels like 9 months with Picplum. One thing we did is for on select menus with few items, we hide the search box: $(".recipient_relation").chosen disable_search_threshold: 10 And if in Backbone you'd like to have it preselect the value, run something like this after render (so you don't have to add much logic to your handlebar template for the markup): @$("#address_country_field option"…

FYI, I had to go finding this the other day - it's tricky as mousing out removes the class. Anyway, it's: .chzn-container .chzn-results .highlighted

Leaving this here in case it helps someone:

In Firebug, you can ask the :hover state to stay active.

    1. HTML tab
    2. Click on the element
    3. Style menu on the right panel
    4. choose :hover
It tricks the browser into thinking the mouse is really over the element (i.e., it doesn't just add :hover), so if you have a hover class added via JS that should work too.

(Apparently this feature has been there for a long time, but I only found it recently. Changed my Firebug life.)

Re: Make Better Select Boxes with Chosen

#45

The project "rationale" has a lot of holes in it. > Instead of forcing your users to scroll through a giant list of items, they can just start typing the name of the item they were looking for. Who's forcing? Modern browsers allow a user to type (in lowercase) text to find in a select element while focused and will scroll to an exact match inside of it. It would require some instructions, but deviations of that behav…

Since when is having a page work without JavaScript "something special"?

Good to know that "graceful degradation" is impossible if you use jQuery or Prototype...

IMO if you're not using a DOM library in 2012 you're doing it wrong (if you say something like "the DOM is great and totally sufficient to do everything I'll ever need" you're either full of shit or trying to sell me something).

Re: Make Better Select Boxes with Chosen

#47

The project "rationale" has a lot of holes in it. > Instead of forcing your users to scroll through a giant list of items, they can just start typing the name of the item they were looking for. Who's forcing? Modern browsers allow a user to type (in lowercase) text to find in a select element while focused and will scroll to an exact match inside of it. It would require some instructions, but deviations of that behav…

I don't think 'massively bloated' is a fair way to describe either jQuery or Prototype. Both of these libraries offer a lot. A better way to say it would be 'picked up some weight recently'.

That being said, I agree that this would be better off without jQuery; when every millisecond, every kilobyte matters, jQuery is simply off the table.

Re: Make Better Select Boxes with Chosen

#48

Chosen.js has a great UI, but I found it challenging to do customizations to the library. I wish that the authors of the library had exposed more event hooks or built it with more modularity. Also worthwhile checking out https://github.com/meltingice/ajax-chosen , which adds much-needed Ajax support to Chosen.js.

I've used this before but it took a lot of fiddling to get the desired functionality out of it.

Re: Make Better Select Boxes with Chosen

#49

There is a newer project named Select2 now which handles remote data sets and offers infinite scrolling: http://ivaynberg.github.com/select2/ (Tried to submit it as a story the other day but zero upvotes.)

If I click on one of these and select something then the next time I click it just flickers instead of opening. I think they have something wrong with their event handlers.

Re: Make Better Select Boxes with Chosen

#50

There is a newer project named Select2 now which handles remote data sets and offers infinite scrolling: http://ivaynberg.github.com/select2/ (Tried to submit it as a story the other day but zero upvotes.)

Nice! Thanks for sharing - with HN as with anything it's as much chance and timing as anything else as to whether a post gets up-voted or sinks unnoticed.
Post reply on HN