Skip to content
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

Open
amit1911 opened this issue Jul 5, 2017 · 5 comments
Open

How to change column reorder drag value? #188

amit1911 opened this issue Jul 5, 2017 · 5 comments
Milestone

Comments

@amit1911
Copy link

amit1911 commented Jul 5, 2017

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?

@miskreant
Copy link
Contributor

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.

@amit1911
Copy link
Author

amit1911 commented Jul 7, 2017

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?

@wcjordan
Copy link
Member

wcjordan commented Jul 7, 2017

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?

@quixotically
Copy link
Contributor

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.

@wcjordan
Copy link
Member

wcjordan commented May 4, 2020

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.

@wcjordan wcjordan added this to the 1.2 milestone May 4, 2020
@pradeepnschrodinger pradeepnschrodinger modified the milestones: v1.2, v2.0 Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants