你好,我用的是nestable2,我想防止子节点拖到另一个父节点。它应该只被拖到它的父节点中。
我已经使用了 nestable2 的这种方法来获取源和目标。我想验证子节点不应拖到另一个父节点。它应该拖入其父级。我已经应用了以下方法,但它没有给我目的地类型,请建议帮助
$('#nestable').nestable({
beforeDragStop: function(l,e, p){
// l is the main container
// e is the element that was moved
// p is the place where element was moved.
var sourcetype = $(e).data('type');//field
var destinationtype = $(p).data('type');//field
var sourcegroupid = $(e).data('groupid');//5
var destinationgroupid = $(p).data('groupid');//5
if (sourcetype == 'field' && destinationtype == 'field') {
if (sourcegroupid == destinationgroupid)//suppose 5=5
return true;
else
return false;
}
}
});