Opened 12 years ago

Closed 9 years ago

Last modified 9 years ago

#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:

  1. On an empty div.
  2. call .tabs()
  3. call .sortable()
  4. add tabs with .tabs('add', .. )
  5. 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 12 years ago by Scott González

#7918 is a duplicate of this ticket.

comment:2 Changed 11 years ago by Scott González

Type: enhancementfeature

comment:3 Changed 11 years ago by Scott González

Milestone: 1.9.02.0.0

comment:4 Changed 11 years ago by Jörn Zaefferer

Status: newopen

Consider for redesign. Make sortable just work in that case or have user call refresh(), and document as such.

comment:5 Changed 11 years ago by Scott González

Summary: Sortable/tabs issue when calling .sortable() before dynamically adding tabsSortable: Floating detection only occurs during initialization

comment:6 Changed 11 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 11 years ago by tj.vantoll

#8540 is a duplicate of this ticket.

comment:8 Changed 10 years ago by tj.vantoll

#9279 is a duplicate of this ticket.

comment:9 Changed 10 years ago by tj.vantoll

#9443 is a duplicate of this ticket.

comment:10 Changed 9 years ago by tj.vantoll

#10083 is a duplicate of this ticket.

comment:11 Changed 9 years ago by tj.vantoll

#10678 is a duplicate of this ticket.

comment:13 Changed 9 years ago by TJ VanToll

Resolution: fixed
Status: openclosed

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 9 years ago by tj.vantoll

Milestone: 2.0.01.12.0

comment:15 Changed 9 years 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 9 years ago by Scott González

Milestone: 1.12.01.11.4
Note: See TracTickets for help on using tickets.