-
Notifications
You must be signed in to change notification settings - Fork 290
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
How to change column reorder drag value? #188
Comments
To my knowledge, we don't currently have an api for these, but in order to change the point at which the columns exchange places, you could make changes to the calculations here. WRT informing the users where the column is going to be dropped, I think they may be interested in displaying a guide line like what we have in place for resizable columns, similar to Google Sheets behavior. I think if you'd like to submit a PR for such, @wcjordan or @KamranAsif may be able to help you with some direction on the best approach. |
thanks @miskreant. i might have some time to submit a PR for 'informing the users where column is going to be dropped' so @KamranAsif, @wcjordan any ideas on how I should proceed? |
I don't have a great solution in mind, but you could use a onmouseenter event to track what column you're over while dragging and then add some style to the header & cells of that column. @quixotically do you have any advice here from your experience building out LiveDesign's column functionality? |
As far as informing the user where a column will be dropped, I've used the HTML drag and drop API to detect when an element is being dragged over, and adding a class to that element if so. The gotcha is to be careful of how the styling will be if the element is going to be dropped before or after its original position - that will likely affect where it will end up being dropped (i.e. off by one errors). You may also need to do something like add a pseudo element so that all positions can be covered (that's what I did), otherwise you won't be able to drop an element to the last or first position, I forget which. I don't have any pointers off the top of my head for changing the mid-way mark value though. I would go with adding styling on drop targets as suggested above. |
Our future column reorder API might make it easier for the user to write custom logic in implementing this. I'll mark this for a future release to ensure this is part of the conversation. |
I have column reordering in my table and I noticed that you need to cross the mid-way mark of the destination column to move the column to that location. Is there a way to change this 'mid-way' mark value? Moreover, is there a way to inform the users about the where the columns is going to be dropped?
The text was updated successfully, but these errors were encountered: