vendredi 13 novembre 2015

Ember refreshModel focus on multiple inputs

I'm having some trouble with keeping my input fields focused while using queryParams and refreshModel: true.

For example:

App.IndexRoute = Ember.Route.extend({
queryParams: {
    createdAt: {
        refreshModel: true
    },
    anotherField: {
        refreshModel: true
    }
}, 

I have an input components that extends TextField:

App.FocusInputComponent = Ember.TextField.extend({
    becomeFocused: Ember.on('didInsertElement', function() {
        this.$().focus();
    })
});

And I call them in my app:

{{focus-input value=createdAt key-up="createdAt"}}
{{focus-input value=anotherField key-up="anotherField"}}

The trouble I'm having is in my focus-input component, as it always focuses on the last field in the list. I can be typing in the first box, then after each letter it moves to the last.

How do I keep my typing focused within the current active input?

Aucun commentaire:

Enregistrer un commentaire