primefaces: Tree: DnD Using `onDrop` controlled mode results in wrong child order
Describe the bug
The drag & drop feature of the tree component works fine, unless we have the following constellation:
Conditions:
- using
onDropcontrolled mode instead ofdropRestrict="sibling". - ajax event
dragdropwith a listener but withoutupdateattribute and - the dragged item is dropped on the same level (reorder only) and
- the dragged item is moved downwards (but not below the last item)
Scenario:
Let there be three items [A, B, C]. To reproduce the bug you must move A one step down between B and C. When the “dragdrop” listener is called, we get a wrong child order:
- Actual [
B,C,A], - Expected [
B,A,C]
Reproducer
PrimeFaces-Reproducer-11513.zip
Expected behavior
(see above)
PrimeFaces edition
Community
PrimeFaces version
13
Theme
irrelevant
JSF implementation
Mojarra
JSF version
4.0
Java version
21
Browser(s)
irrelevant
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (12 by maintainers)
Commits related to this issue
- Fix #11513: Tree wrong dnd index for sibling going down — committed to melloware/primefaces by melloware 3 years ago
- Fix #11513: Tree wrong dnd index for sibling going down — committed to melloware/primefaces by melloware 3 years ago
- Fix #11513: Tree wrong dnd index for sibling going down (#11515) — committed to primefaces/primefaces by melloware 3 years ago
- Fix #11513: Tree wrong dnd index for sibling going down (#11514) — committed to primefaces/primefaces by melloware 3 years ago
- Fix #11513: Tree wrong dnd index for sibling going down (#11514) — committed to primefaces/primefaces by melloware 3 years ago
- Fix #11513: Tree wrong dnd index for sibling going down (#11514) — committed to primefaces/primefaces by melloware 3 years ago
- Revert #11513 — committed to primefaces/primefaces by melloware 3 years ago
- Revert #11513 — committed to primefaces/primefaces by melloware 3 years ago
Excellent! This workaround fixes the symptoms 👍
MonkeyPatch if you want to try it now…