-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[data grid] Column reordering does not work on touchscreen #9330
Comments
Column reordering is based on the HTML5 drag'n'drop API. Unfortunately, this API is only supported on desktop browsers for now. We should listen to the touch events on mobile instead, like what https://react-dnd.github.io/react-dnd/docs/overview does. |
As per this, https://caniuse.com/?search=drag, its supported for chrome android and safari ios but column reordering is not working there as well. |
Initially I thought that |
So, right now we don't have much support for drag and drop on mobile/ipads with react? Does data grid exposes some props which i can use to listen to touch events? |
No, Android is also affected.
Also no, but you can attach listeners to the DataGrid and filter the events keeping only those that come from the column headers. While that, I've working on #9394 to fix the column reordering on mobile devices. Could you test the preview from this PR to see if it works now? It appears that the HTML5 drag'n'drop API behaves differently between desktop and mobile. |
I was able to test few scenarios. Here's my experience with it: |
We need a general solution for drag and drop on touch screens – for column reordering, row reordering, and pivot panel. |
Hey @cherniavskii, recently I had to develop a drag-and-drop functionality for a side project in vanilla JS and since I also needed to support touch-devices I think I have something to share here. First thing I did was to ditch the HTML |
Thanks, @m4theushw, I appreciate your input!
I used this for the resize handle in https://github.com/cherniavskii/mui-x/blob/pivoting/packages/x-data-grid-premium/src/hooks/utils/useResize.ts
Since you didn't use I've played with d&d for the pivoting panel in #9877 – I used |
I don't show an image of the element being dragged, but a "ghost" of it. Most spreadsheet apps behave like that, e.g. Airtable: In the DataGrid I think this might be better because it doesn't require a re-render of the rows when a column is moved. You can just have an absolute-positioned container extending the full height and update its |
Got it 👍🏻 |
Are there any updates on this? Column reordering on mobile devices is crucial for my customers. Proposed workaround: Add reordering functionality using 'up' and 'down' arrow buttons in the column preferences panel? |
Order ID or Support key 💳 (optional)
55910
The problem in depth 🔍
I am creating a configurable tables for our users where they can set their column orders as they see fit. We have a lot of users using our product in iPad and they can't reorder columns on ipad.
I even checked the code sandbox provided in Mui docs. Even there reordering is not working. Do we need to pass some special props to make it work?
Link to live example:
https://codesandbox.io/s/2zggjy?file=/demo.tsx
Steps:
Your environment 🌎
`npx @mui/envinfo`
The text was updated successfully, but these errors were encountered: