[ 2 posts ]

PQR

  • Joined: Mon Jan 02, 2012 1:07 pm
  • Posts: 37
  • Offline
  • Profile

Sortable vs. DD List Reorder w/Bubbling

Post Posted: Fri Mar 16, 2012 10:43 am
+0-
I look into Sortable utility (http://yuilibrary.com/yui/docs/sortable/) and Drag and Drop example called "List Reorder w/Bubbling" (http://yuilibrary.com/yui/docs/dd/list-drag.html).

"List Reorder w/Bubbling" is an example with a lot of manual code to handle drag-and-drop events. Sortable is a final library solution to make the same think in several lines of code.

What I actually need in my projects is Sortable multiple lists with full join: http://yuilibrary.com/yui/docs/sortable ... -full.html

Problem:
I found that using sortable utility I cant drop item on empty container space. For example in list 1 you have a few records but the "content box" of list 1 is bigger. Draggin item from list 2 I cant drop it into empty space in list 1. I can drop only on another li element in list 1. Example: http://jsfiddle.net/TR5Xv/
This cause bad user experience.

On other hand the example "List Reorder w/Bubbling" woks perfect with drop on empty space (example: http://yuilibrary.com/yui/docs/dd/list-drag.html)

Question:
Is it a bug in Sortable utility or there is a way to enable empty space as place where I can drop an element?

Actually, I found a workaroud: I changed function _onDropOver in srotable.js source.
Original code:
Code:
_onDropOver: function(e) {
if (!e.drop.get(NODE).test(this.get(NODES))) {
    var nodes = e.drop.get(NODE).all(this.get(NODES));
    if (nodes.size() === 0) {
        e.drop.get(NODE).append(e.drag.get(NODE));
    }
}
}


My changes:
Code:
_onDropOver: function(e) {
if (!e.drop.get(NODE).test(this.get(NODES))) {

    e.drop.get(NODE).append(e.drag.get(NODE));

}
}


But I am not sure that this is correct path because I do not understand yet the whole drag-and-drop internal mechanisms.

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile

Re: Sortable vs. DD List Reorder w/Bubbling

Post Posted: Fri Mar 23, 2012 9:17 am
+0-
File a ticket on this:

http://yuilibrary.com/projects/yui3/new ... t=Sortable
  [ 2 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum