Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

101
Views
Deactivate drag and drop for table in react

I want to deactivate the drag and drop function for the table. Can anyone tell me how we can do this?

return(
        <div 
            className="grid-container"
        >
            <table
                className="grid-table" 
                onMouseLeave={() => props.handle_mouse(false)}
                onMouseDown={() => props.handle_mouse(true)}
                onMouseUp={() => props.handle_mouse(false)}
            >
                <tbody>
                    {grid}
                </tbody>
            </table>
        </div> 
    )
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to keep track of the disabled state of your drag n drop. and return nothing if the state says it's disabled.


let isDisabled = false

// Logic to handle `isDisabled` state that would set it to true

return(
        <div 
            className="grid-container"
        >
            <table
                className="grid-table" 
                onMouseLeave={() => props.handle_mouse(false)}
                onMouseDown={() => isDisabled ? null : props.handle_mouse(true)}
                onMouseUp={() => props.handle_mouse(false)}
            >
                <tbody>
                    {grid}
                </tbody>
            </table>
        </div> 
    )
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!