#7498 closed feature (fixed)
Sortable: Floating detection only occurs during initialization
| Reported by: | jamesh | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.11.4 |
| Component: | ui.sortable | Version: | 1.8.13 |
| Keywords: | Cc: | ||
| Blocked by: | Blocking: |
Description
Tested with Firefox 4.0.1 on Windows 7. jQuery UI 1.8.13
Example: http://jsfiddle.net/RS6bg/1/
Reproduce:
- On an empty div.
- call .tabs()
- call .sortable()
- add tabs with .tabs('add', .. )
- Sorting is then partially broken.
this.floating is only determined during _create() (on line 53 in jquery.ui.sortable.js), so when floating items are added later on this.floating is incorrect.
I'm not sure whether this is indeed a bug, or just misuse, as I have fixed my problem by moving the .sortable() after .tabs('add').
Perhaps advising the user of this potential problem in the tabs documentation.
Change History (16)
comment:1 Changed 5 years ago by scottgonzalez
comment:2 Changed 4 years ago by scottgonzalez
- Type changed from enhancement to feature
comment:3 Changed 4 years ago by scottgonzalez
- Milestone changed from 1.9.0 to 2.0.0
comment:4 Changed 4 years ago by jzaefferer
- Status changed from new to open
Consider for redesign. Make sortable just work in that case or have user call refresh(), and document as such.
comment:5 Changed 4 years ago by scottgonzalez
- Summary changed from Sortable/tabs issue when calling .sortable() before dynamically adding tabs to Sortable: Floating detection only occurs during initialization
comment:6 Changed 4 years ago by tj.vantoll
The internal floating flag is also used to determine horizontal vs. vertical sorting.
And, because this.floating is only determined in _create, if you start with an empty sortable it is assumed to be vertical. You can see the problem this creates in the following two examples:
Vertical works: http://jsfiddle.net/tj_vantoll/4A42n/ Horizontal doesn't: http://jsfiddle.net/tj_vantoll/s867Q/
Another reason to have refresh update this value.
comment:7 Changed 4 years ago by tj.vantoll
#8540 is a duplicate of this ticket.
comment:8 Changed 4 years ago by tj.vantoll
#9279 is a duplicate of this ticket.
comment:9 Changed 3 years ago by tj.vantoll
#9443 is a duplicate of this ticket.
comment:10 Changed 2 years ago by tj.vantoll
#10083 is a duplicate of this ticket.
comment:11 Changed 2 years ago by tj.vantoll
#10678 is a duplicate of this ticket.
comment:12 Changed 2 years ago by tj.vantoll
comment:13 Changed 2 years ago by TJ VanToll
- Resolution set to fixed
- Status changed from open to closed
Sortable: Redetermine floating flag when recalculating positions
This addresses a bug where users initialize empty sortable lists are add items dynamically. In this situation refresh() should recognize the position and orientation of the new items.
Fixes #7498 Closes gh-1381
Changeset: f656aebe3f99356b7eb91ffdafe6689ecc8fb4ae
comment:14 Changed 2 years ago by tj.vantoll
- Milestone changed from 2.0.0 to 1.12.0
comment:15 Changed 21 months ago by TJ VanToll
Sortable: Redetermine floating flag when recalculating positions
This addresses a bug where users initialize empty sortable lists are add items dynamically. In this situation refresh() should recognize the position and orientation of the new items.
Fixes #7498 Closes gh-1381 (cherry picked from commit f656aebe3f99356b7eb91ffdafe6689ecc8fb4ae)
Changeset: 189f1d476c2d6f53c88f9e92bdaffbc64ed9c572
comment:16 Changed 21 months ago by scottgonzalez
- Milestone changed from 1.12.0 to 1.11.4
#7918 is a duplicate of this ticket.