Skip to main content

Search and Top Navigation

#10328 closed bug (duplicate)

Opened July 22, 2014 02:28PM UTC

Closed July 22, 2014 02:42PM UTC

Sortable beforeStop callback plus event.preventDefault() leads to error

Reported by: glennfu Owned by:
Priority: minor Milestone: none
Component: ui.sortable Version: 1.11.0
Keywords: Cc:
Blocked by: Blocking:
Description

I have two lists, one sortable, and one not sortable, but I want to drag from the non-sorting one to the sortable one. In other words, I have a bucket of sortable things, and I have a place from where I can add new items to that list. To achieve this, on the sortbeforestop I call:

var source_table = $(event.target);
var dest_table   = $(ui.item).closest("tbody");
    
if (source_table.is(dest_table) && dest_table.closest("table").is("#my-non-sortable-table")) {
    event.preventDefault();
}

This works perfectly, except afterwards I see there is an error in the console on sortable.js line 1275:

TypeError: this.placeholder[0].parentNode is null
this.placeholder[0].parentNode.removeChild(this.placeholder[0]);

The fix, I'm guessing, would be:

if (this.placeholder[0]) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);

Hope that helps!

Attachments (0)
Change History (1)

Changed July 22, 2014 02:42PM UTC by scottgonzalez comment:1

resolution: → duplicate
status: newclosed

Duplicate of #6054.