Skip to content

Changing the Focus to a Cell #2221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cks333 opened this issue Nov 25, 2014 · 5 comments
Closed

Changing the Focus to a Cell #2221

cks333 opened this issue Nov 25, 2014 · 5 comments
Assignees
Milestone

Comments

@cks333
Copy link

cks333 commented Nov 25, 2014

We have a scrollto method in Angular UI-Grid which scrolls and brings the given row/col in our view if they are not in view.

What I need now is something which will give focus to the given row/col to. For example selecting the given row/col from a function. Possibly a scrollToFocus()?

I am using inline editing in the ui-grid and the focus has to go to a particular cell as per the user input in a cell and hence this need. Eg: User edit the data in A5 and the focus has to go to A6 automatically without the user manually clicking on the A6 cell.

For now, I managed to do a simple hack using JQuery to achieve this. Every cell has its own div tag in ui-grid. I just introduced an id attribute based on the [PRIMARYKEY][COLUMN_NAME]. Then used the .focus() using JQuery to achieve the task. Works perfectly as required. Having said that, if we have a scrollToFocus(), it will be nice angularly !

@saithis
Copy link

saithis commented Nov 28, 2014

I had the same Problem today and also had to do a dirty hack with JQuery.
Would be nice to have a api method for this.

@PaulL1 PaulL1 added this to the 3.0 milestone Dec 7, 2014
@PaulL1 PaulL1 self-assigned this Dec 7, 2014
PaulL1 added a commit to PaulL1/ng-grid that referenced this issue Dec 17, 2014
PaulL1 added a commit to PaulL1/ng-grid that referenced this issue Dec 17, 2014
@PaulL1 PaulL1 closed this as completed in 1194558 Dec 17, 2014
PaulL1 added a commit that referenced this issue Dec 17, 2014
Fix #2221 (cellNav): Add scrollToFocus method
@c0bra c0bra removed the in progress label Dec 17, 2014
@cks333
Copy link
Author

cks333 commented Dec 17, 2014

Hi Paul / Brian,

Thanks for your quick turnaround. Much Appreciated. I am yet to test this but will be doing sometime this week. Once again, many thanks !!!

//Senthil

@destanoglu
Copy link

Does anyone can manage to start editing wirh scrollToFocus method?

@vaibhavsharma27
Copy link

I am facing a problem when I add a row programatically and I use this scrollToFocus method. When there is no vertical scrollbar then I am getting focus on last added row, and when there is a scrollbar, I am getting the scrollbar at the last row, but there is no focus.

@B00TMan
Copy link

B00TMan commented Apr 6, 2018

@feralanPaladin I was able to start editing in a hacky way by setting a custom cellClass to the cell i was aiming for, then I queried for this cell and did an element.dispatchEvent(dblClickevent) to simulate a click into the cell.

https://stackoverflow.com/questions/18399215/how-to-programmatically-fire-a-dblclick-event-defined-with-addeventlistener

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants