This repository was archived by the owner on Apr 3, 2018. It is now read-only.
Ensure draggable placeholder has same column structure as dragged item.#7
Open
benhuson wants to merge 1 commit into
Open
Ensure draggable placeholder has same column structure as dragged item.#7benhuson wants to merge 1 commit into
benhuson wants to merge 1 commit into
Conversation
Copies the column structure of the dragged item, empties all the cell content and uses that as the placeholder to ensure the table structure is preserved.
|
Hi @benhuson - this seems like a reasonable approach to me, although I want to take a closer look at how that jQuery placeholder works just so I know and we can add an inline comment explaining it for future reference. It's been a long time since you opened this, and the repo location and structure have changed in the meantime - any chance you'd be up for re-opening this PR against https://github.com/10up/simple-page-ordering/ so you can get that in your GH history? If not, that's okay - I can use the GitHub co-authors functionality to at least get you commit credit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This plugin in the best one I've found for drag-n-drop WordPress page ordering within the core admin UI 👍
However, we found an issue where sometimes when dragging the a row, the table structured messed up. The placeholder element seemed to have more columns than the table and so the table ended up with lots of empty (non-existent) cells on the right which pushed everything out of alignment.
The worse thing out this was that if you were half way down a scrolled page, when you started dragging an item the page would jump so the dragged item was instantly in the wrong place so you could'nt just drop it in exactly the same place or drag it one or two places in the table easily.
This PR copies the column structure of the dragged item, empties all the cell content and uses that as the placeholder to ensure the table structure is preserved. This prevents the page jump for a much smoother experience.
I've done some testing and it seems to work well, so if you can confirm this is a good solution I'd love to see it fixed in the core plugin.
Many thanks for your efforts with this plugin.
Ben