Bug Tracker

Opened 12 years ago

Closed 12 years ago

#1683 closed bug (fixed)

Sortable slow with long lists (partial fix included)

Reported by: sqrrrl Owned by: paul
Priority: major Milestone: 1.2.1
Component: ui Version: 1.2.1
Keywords: Cc:
Blocked by: Blocking:

Description

Dragging sortables with long lists is slow. There is a significant lag when the lists get to be > 50 items. I found one very quick fix, which at least addresses sorting near the top half of the list.

In drag, simply breaking the loop once an overlapping element is found speeds things up dramatically. I added breaks as shown...

				if(overlap >= 0 && overlap <= 0.5) { //Overlapping at top
					ci.prev().length ? ma(this.element) : mb(this.element);
                    break;
				}

				if(overlap < 0 && overlap > -0.5) { //Overlapping at bottom
					ci.next()[0] == this.element ? mb(this.element) : ma(this.element);
                    break;
				}

Another possibility, which I haven't tried yet, is to track element positions during drag so we check for overlaps with the closest elements first rather than restarting at the top of the list each time.

Change History (3)

comment:1 Changed 12 years ago by sqrrrl

BTW - See ticket #1680 for modified version that contains several performance fixes.

comment:2 Changed 12 years ago by paul

Owner: set to paul
Status: newassigned

comment:3 Changed 12 years ago by paul

Resolution: fixed
Status: assignedclosed

Added the breaks! I'm investigating more speed fixes.

Note: See TracTickets for help on using tickets.