I need to fire the function when keypress on cell #70
Answered
by
nick-keller
chairedevil
asked this question in
Q&A
-
In my project. In the same column, some rows can call a drawer when enter key is pressed. |
Beta Was this translation helpful? Give feedback.
Answered by
nick-keller
Oct 20, 2021
Replies: 1 comment 1 reply
-
This is not related to RDG but to React itself. You need to use a useEffect hook: import { CellProps } from 'react-datasheet-grid'
const TestEnter = (data: CellProps) => {
useEffect(() => {
if (data.focus && data.rowData.type === 0) {
console.log('RUN function')
data.stopEditing({ nextRow: false })
setIsOpenDrawer(true)
}
}, [data.focus, data.rowData.type, data.stopEditing, setIsOpenDrawer])
return <div>{data.rowData.test2}</div>
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
nick-keller
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is not related to RDG but to React itself. You need to use a useEffect hook: