primevue icon indicating copy to clipboard operation
primevue copied to clipboard

Focus on DataTable input field programatically

Open fabiante opened this issue 4 years ago • 4 comments

I'm submitting a ... (check one with "x")

[ ] bug report => Search github for a similar issue or PR before submitting
[X] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primevue/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=110

Hi!

My team and I have been working for quiet some time on how to programatically focus on an input field / cell in a data table.

In our application there are several use cases where we would need an API that would allow us to "simply" focus on a cell (or input in a cell if present) like this:

dataTable.focusXY(1, 3) // Focuses on the second row and the fourth column
dataTable.focus(1, "MyColumn") // Focuses on the second row and the column identified by "MyColumn"

Right now we are working an a monkey patch based on plain HTML handling but that sure doesn't feel production ready.

Is there such a feature that I may be missing?

fabiante avatar May 12 '21 08:05 fabiante

There is no such feature, if there is more demand on this we'll add it for sure.

cagataycivici avatar May 18 '21 08:05 cagataycivici

Thank you for your response! Our current solution is to use the ref mechanic of Vue upon mounting the component to manually create a data structure that allows for a quick access to the related input html elements of each cell.

fabiante avatar May 19 '21 19:05 fabiante

Do you have an example of your current solution, i'm interested on this feature

ggarzam avatar Jun 24 '21 22:06 ggarzam

This would be a nice feature...

Dazaer avatar Apr 21 '22 23:04 Dazaer

Issue tracker is used for defects only as part of our commitment to quality and continuous improvement in all areas. Enhancements are collected as valuable community feedback and managed internally so moving this enhancement ticket to our internal project management backlog.

tugcekucukoglu avatar Oct 30 '23 08:10 tugcekucukoglu