primefaces / primefaces/primereact
DataTable: Allow disabling or passing arbitrary selector to focusOnElement onRowEdit
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 8.3k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the feature you would like to see added
I'm migrating from v6 to v8. In v6 I was able to instruct the DOM to select the first <Input> of the row by setting autoFocus={true} on a <Column>'s editor property.
After upgrading to v8 this no longer works as datatable/BodyCell.js#L192 focusOnElement function sets focus to .p-row-editor-save automatically.
I would like to have the ability to either:
- disable the autofocus event onRowEdit
- provide an element selector
Thanks!
Is your feature request related to a problem?
With conflicting autoFocus and focusOnElement statements the DOM executes an onBlur after every keystroke.
Describe the solution you'd like
I would like to have the ability to either:
- disable the autofocus event onRowEdit
- provide an element selector
Describe alternatives you have considered
No response
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in components/lib/datatable/BodyCell.js at the focusOnElement function linked in the issue, and trace how it is invoked during DataTable onRowEdit. Compare that behavior with the Column editor autoFocus behavior described for v6. Done means onRowEdit can either suppress the automatic focus or use a caller-provided selector without causing the reported onBlur behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100