Nestable2 icon indicating copy to clipboard operation
Nestable2 copied to clipboard

How to prevent child node to dragged in another parent node

Open bugfirstx opened this issue 3 years ago • 1 comments

xZAfn (1)

Thank you

bugfirstx avatar Feb 02 '22 05:02 bugfirstx

prevent child to go parent and parent to go child, my guess is that you have just to play with parent id to get what you want on top

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. m_element = $(e).data('type'); t_element = $(p).hasClass('nestable');

    if(m_element == "child"){
      if (t_element){
        return false;
      }else{
        return true;
      }
    }else if (m_element == "root"){
      if (t_element){
        return true;
      }else{
        return false;
      }
    }
}

b-cil avatar Jul 21 '22 19:07 b-cil