arturadib / agility

Javascript MVC for the "write less, do more" programmer
http://agilityjs.com
MIT License
542 stars 70 forks source link

Add input type="search" support to data-bind, make it tight #17

Closed arturadib closed 13 years ago

arturadib commented 13 years ago

Tight means the model is updated upon every keystroke. This is particularly useful in the context of instant searches.

var obj = $$({query:''}, '<input type="search" data-bind="query"/>', {
  'change:query': function(){
      ... do search here ...
  }
});

For regular searches, the user will need to capture the enter key, and/or a click on a button.

Wizek commented 12 years ago

Is this complete?

arturadib commented 12 years ago

Is this complete?

Not sure what you mean by "complete", but we have a working version - try the second demo in this section:

http://agilityjs.com/docs/docs.html#bindings

Wizek commented 12 years ago

@arturadib Sorry for not being more verbose with my question, I couldn't get this to work for a while, but then I realized that type attr has to be specified, or otherwise it won't work.

Feature request #1: If type isn't present on input element, default to type="text" Feature request #2: Instant data binding should't be bound to only type="search", but accessible on other types too!

So far I enjoy playing with Aility.js, it's much more rewarding that my unsuccessful experiments (due to the complexity and me being stranger to MVCs) with Backbone.js, but issues like this make me think wheter or not backbone provides more flexibility to it's users. I'd like to hear your view on that subject too as I suspect you know both quite well.

Wizek commented 12 years ago

@arturadib Should I open new issues for the above two?

arturadib commented 12 years ago

That sounds good Wizek.