PDA

View Full Version : Strange behavior with D&D grids



syph252
8 Mar 2007, 7:24 AM
I'm working off the example found here:
http://www.jackslocum.com/blog/2006/09/30/drag-and-drop-with-the-grid-part-2/

If you increase the number of elements in these lists to more than what's visible (say double the size of the list, to 16), then select all 16 elements and try to drag and drop them, you'll see the strange behavior I'm getting.

The list items seems to reduce in size for a moment and then disappear entirely.

It doesn't matter whether you use Example 1 or Example 2. The behavior occurs when you release the items.

Has anyone else experienced this or know how to fix it?

Thanks.

syph252
8 Mar 2007, 7:58 AM
Got it. The problem was actually on the following line in ddgrid.js:


indexes.sort();
When I had lists greater than 10, the ordering was 0,1,11,12,13,2,3,4,5,...

The solution was to pass a sortby function.

Thanks.