0
我得到以下错误,当我排序/重新排列div QUICKLY。jquery排序用户界面异常
TypeError: this.placeholder[0].parentNode is null
JQuery的UI是API,我使用:http://jqueryui.com/sortable/
$("#contents").sortable({
beforeStop: function (event, ui) {
console.log("BeforeStop Fn Invoked:Parent Node Val: " + $(ui.placeholder).parent()[0]);
if (typeof ($(ui.placeholder).parent()[0]) === 'undefined') {
console.log("If condition passed: " + ($(ui.placeholder).parent()[0]));
$("#contents").sortable('cancel');
}
console.log("BeforeStop Fn Terminates");
},
stop: function (event, ui) {
console.log("Inside Stop Function");
var op = $(this).sortable('toArray');
for (i = 0; i < result.length; i++) {
result[i] = result[i].replace('-sn', '');
}
var contents_identifier = JSON.stringify(op);
$.post(baseurl + 'index.php', {
para1: contents_identifier
},
function (data) {
fill_content_table();
});
console.log("Stop Fun Terminated\n");
}
}).disableSelection();
每当我得到上面的错误,这是控制台的萤火虫打印什么:
我猜一旦停止功能被执行,异常或上述错误就会发生(因为我看不到调试语句Inside Stop Function)。
尝试了几件事情,如延迟处决。但它没有奏效。 任何帮助表示赞赏。
UPD: 请注意,以下是在成功的情况下控制台输出:
##################################################################
BeforeStop Fn Invoked: Parent Node Val: [object HTMLDivElement]
BeforeStop Fn Terminates
Inside Stop Function
POST https://www. 200 OK 730ms
Stop Fun Terminated
####################################################
POST https:www.........200 OK 734ms