Skip to content

I need to fire the function when keypress on cell #70

Answered by nick-keller
chairedevil asked this question in Q&A
Discussion options

You must be logged in to vote

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>
  }

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@chairedevil
Comment options

Answer selected by nick-keller
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants