It's not that hard to make it, but still no convenient way yet, I had a try and let's see the result in sandbox: https://codesandbox.io/s/quizzical-leakey-o5h8z
Then let's see what's going on in Table.js
1.When you start dragging, you do not know which direction it is going, so I just hide the snippet (by setting it to empty div)
2.When you first drag it into another cell I got to know the direction, and then lock the direction inside
3.When you drag it into an cell (including first time in step 2), you need to show the changed data, like
rows = offsetIndex(dragState.row, dragState.dropIndex, rows), notice it is different depends on
4.We highlight the row/column we are dragging, with
5.Finally on dragEnd we notify parent component what have changed
It's not good enough yet, specially when the drag is cancled. So don't rely on these code too much, find your own way based on this idea
- How to use drag and drop functionality both columns and rows in my React Table - ReactJS
- Creating a table that can drag and drop both columns and rows on React
- How to make a react table whose rows and columns come from a JSON object
- Reordering table columns with react via drag and drop
- table's both column and row reordering , drag and drop also edit the table cell in react js
- How do you use state variables to make a nested drag and drop in React / Kanban board not working in React
- How do I wrap a React component that returns multiple table rows and avoid the "<tr> cannot appear as a child of <div>" error?
- How to make some columns align left and some column align center in React Table - React
- Drag and Drop in React.js. How to pass custom react component in setDragImage
- How can I prevent drag and drop images in a react app?
- How to handle React Svg Drag and Drop with React Hooks
- How to make some columns fixed and some columns draggable in React Table - ReactJS
- How to position columns at the left and data at the right of material UI table for React
- How to hide a column on REACT Material table in all rows and show it on Edit for the Particular Row I am editing and Add Operations on new row adding?
- How to expand and collapse the table rows in plain react js. Show only one row if the description of the row is multiple and show the expand button
- React antd nested table and drag & drop sorting
- How to use drag and drop in ant design?
- How to save the state of drag and drop rows in React?
- How to print out rows and columns in my React component
- Modify Json to use into React beautiful Drag and drop
- How to transform a table rows into columns while using react
- Deactivate drag and drop for table in react
- React and redux toolkit: how to add reducer that gets data from a drag and drop event
- Drag and drop functionality in React returns erros
- How to remove duplicate files when files are drag and drop in a react component using HTML drag and drop
- How to use for loop in react so I can loop over two array and return the object in second array if both match
- React Formik : how to use custom onChange and onBlur
- How to show and hide some columns on React Table?
- How to simulate a drag and drop action in puppeteer?
- How to use React with Typescript and SASS
More Query from same tag
- Can using .map() twice over the same array be avoided even though the components the map() renders are not siblings?
- React Material-UI TextInput with fixed text along with placeholder
- Next JS Returned Element Does Not Apply CSS
- Express React Router Internal Server Error When Linked Directly
- Why actions in reduxjs-toolkit are not exported ? (Reactjs - reduxToolkit)
- How to simplify updating state of Quiz component in React?
- why filtering state array with react hooks doesn't work but filtering original array does
- Why is ESM throwing a syntax error in react backend?
- How to use context api with react router v4?
- Avoiding inline functions in React: How to bind functions with arguments?
- Bollinger bands in React application with a library
- is there a way to build a react app in a single html file?
- While loop based on component state value
- Flow error "props is incompatible with empty" when instantiating a Component without passing any props
- Confused for loop in react
- Input field is not working
- react, map component, unexpected result
- I'm trying to fetch my json site to enable API, but but got an error "Unexpected token < in JSON at position 0"
- What is the best way to stop the date updating in react?
- ReactJS, add class to one button, not all (in .map render)
- Call a method from another Component after the Async function reactjs
- How to make a unique text for each click?
- Chrome Storage API to set state in useState
- React - set state of parent component to close modal from a child component
- React - Giving a function to my Child Component
- How to genrate dynamically feild while selecting specific option from Select Box
- How can you return all of the numbers that you loop through in an array?
- Working with react-spring and styled-components
- Webpack - Build css not applied
- How to handle stale state and get the latest value of it inside a function in react?