aslagle / reactive-table

A reactive table designed for Meteor
https://atmospherejs.com/aslagle/reactive-table
Other
328 stars 137 forks source link

focus on $('.reactive-table-input') #423

Closed ndunhour closed 8 years ago

ndunhour commented 8 years ago

I've tried several different codes to have the cursor start in $('.reactive-table-input'). I'm using Meteor

  1. tried it on Render and create $('.reactive-table-input').focus();
  2. tried it in css .reactive-table-input:focus{background-color: yellow;}
  3. even in the html {{> reactiveTable settings=settings autofocus}}

    1 and #3 didn't do anything. #2 did turn yellow when I clicked in the input box.

Any other suggestions?

Thank you

aslagle commented 8 years ago

Your first option should work, is this what you tried:

Template.myTemplate.onRendered(function() {
  $('.reactive-table-input').focus();
});
ndunhour commented 8 years ago

I tried that code, the cursor doesn't display in the input box.

aslagle commented 8 years ago

It works for me, so I don't know what could be wrong. Maybe there's something else in your app that's getting focus after the code runs?

ndunhour commented 8 years ago

This is the only item that I need the cursor to focus on. The whole app is built around that particular input box and the results that is populated as user type. I'm not sure either. No worries.