public/assets/plugins/pickletree/pickletree.js
/**
   * this method will check node childs and his parents if not checked.
   * @param {object} node
   */
this method will check node childs and his parents if not checked.
@param {object} node
this method will check node childs and his parents if not checked . @param { object } node
checkNodeFamily(node) {
    let status = node.checkStatus;
    let parentCheck = async (node) => {
      if (node.parent.id !== 0) {
        node = node.parent;
        let trans = () => {
          node.checkStatus = status;
          this.checkNode(node);
          parentCheck(node);
        };
        if (!status) {
          let valid = true;
          let childs = node.getChilds();
          for (let i = 0; i < childs.length; i++) {
            if (childs[i].checkStatus) {
              valid = false;
            }
          }
          if (valid) trans();
        } else {
          trans();
        }
      }
    };
    let childCheck = async (node) => {
      this.checkNode(node);
      if (node.childs.length > 0) {
        for (let i = 0; i < node.childs.length; i++) {
          let c_node = this.getNode(node.childs[i].split('node_')[1]);
          c_node.checkStatus = status;
          childCheck(c_node);
        }
      }
    };
    if (this.config.autoChild) childCheck(node);
    if (this.config.autoParent) parentCheck(node);
  }
checkNodeFamily ( node ) { let status = node . checkStatus ; let parentCheck = async ( node ) => { if ( node . parent . id !== 0 ) { node = node . parent ; let trans = ( ) => { node . checkStatus = status ; this . checkNode ( node ) ; parentCheck ( node ) ; } ; if ( ! status ) { let valid = true ; let childs = node . getChilds ( ) ; for ( let i = 0 ; i < childs . length ; i ++ ) { if ( childs [ i ] . checkStatus ) { valid = false ; } } if ( valid ) trans ( ) ; } else { trans ( ) ; } } } ; let childCheck = async ( node ) => { this . checkNode ( node ) ; if ( node . childs . length > 0 ) { for ( let i = 0 ; i < node . childs . length ; i ++ ) { let c_node = this . getNode ( node . childs [ i ] . split ( 'node_' ) [ 1 ] ) ; c_node . checkStatus = status ; childCheck ( c_node ) ; } } } ; if ( this . config . autoChild ) childCheck ( node ) ; if ( this . config . autoParent ) parentCheck ( node ) ; }
this method will check node childs and his parents if not checked.
this method will check node childs and his parents if not checked .
//first check if has parent //get parent node //change parent node status //check parent node //then restart process //decide for uncheck //if all childs is unchecked or child count is equal to 1 //first check main node //then check childs if exist //foreach child //restart process