How to improve this dropdown plugin for ember?


Hello everyone, I’ve been busy working on this ember dropdown plugin for the last little while. It works, however I need some advice on how to improve it. A couple of noteable things

  1. I want to make this generic, so that the search results are tired to some sort of binding, like dropdownBinding = “myDataSource” but I’m not sure how to go about that, do I put all the dropdown login in the view?

  2. When the user starts typing it should jump to the first result, I tried observing the open property of the dropdown but it fires before the content is rendered. My plan was to do this.$("ul > li:first-child).class(‘selected’); or something but like I said the content does exist yet when the observe fires, so this fails.

  3. When the user leaves the text field it should close the dropdown, but I’m not sure how to observe when the textfield is closed. I’m sure it fires a focused event that I could listen for some how.

  4. Whatever value is selected should populate the field

  5. Pressing down should select the next item in the list.

How could I implement these features in an ember centric way? I guess the real problem here is figuring out how to bind the text area to the dropdown so that they can listen to each others events and share data, but again I’m not sure how I’d go about that ember.

Thanks! –Michael