public/assets/plugins/pickletree/pickletree.js
/**
   * this method will update node
   * !! id is recommended
   */
this method will update node
id is recommended
this method will update node id is recommended
updateNode(node) {
    this.getNode(node.id.split('node_')[1]).deleteNode();
    if (node.old_parent !== undefined && node.old_parent.id !== 0) {
      this.nodeList[node.old_parent.value].childs = this.nodeList[
        node.old_parent.value
      ].childs.filter((x) => {
        return x !== node.id;
      });
      if (this.nodeList[node.old_parent.value].childs.length === 0) {
        document.getElementById('i_' + node.old_parent.id).style.display =
          'none';
      }
    }
    let set = (data) => {
      this.drawNode(data);
      let childs = data.getChilds();
      if (childs.length > 0) {
        for (let i = 0; i < childs.length; i++) {
          set(childs[i]);
        }
      }
    };
    set(node);
    this.log('Node is created (' + node.id + ')');
    return node;
  }
updateNode ( node ) { this . getNode ( node . id . split ( 'node_' ) [ 1 ] ) . deleteNode ( ) ; if ( node . old_parent !== undefined && node . old_parent . id !== 0 ) { this . nodeList [ node . old_parent . value ] . childs = this . nodeList [ node . old_parent . value ] . childs . filter ( ( x ) => { return x !== node . id ; } ) ; if ( this . nodeList [ node . old_parent . value ] . childs . length === 0 ) { document . getElementById ( 'i_' + node . old_parent . id ) . style . display = 'none' ; } } let set = ( data ) => { this . drawNode ( data ) ; let childs = data . getChilds ( ) ; if ( childs . length > 0 ) { for ( let i = 0 ; i < childs . length ; i ++ ) { set ( childs [ i ] ) ; } } } ; set ( node ) ; this . log ( 'Node is created (' + node . id + ')' ) ; return node ; }
this method will update node
 !
this method will update node !
//first remove old node //console.log(this.getNode(node.id.split('_')[1])) //clear old parent's childs if old parent info is exist //if child count is 0 then remove minus icon //draw new node with childs //log //return node