jeudi 13 septembre 2018

Simulate tab key press (Ember.js)

Good day!

I have a collection of textfields and they're arranged horizontally, What I want is to imitate Mircosoft excel's behaviour when I press the enter key it would automatically go down to the next row and focus on first input.

One approach I'm looking forward is to simulate tab press when I press the enter key.

For now I'm using this jquery approach:

function save() {
  let focusedElement = Ember.$(event.target);
  let nextForm = 5; //some integer value to get the next ember-id
  Ember.$("#ember"+ nextForm +"").select();
}

I want to make it more Ember way because right now it's anti component pattern.




Aucun commentaire:

Enregistrer un commentaire