public/assets/plugins/pickletree/pickletree.js
/**
   * this method will draw multiple data
   */
this method will draw multiple data
this method will draw multiple data
drawData() {
    if (this.data.length > 0) {
      let order = (list, p = { n_id: 0, Child: [] }, tree = []) => {
        let childrens = list.filter((y) => y.n_parentid === p.n_id);
        if (childrens.length > 0) {
          if (p.n_id === 0) {
            tree = childrens;
          } else {
            p['Child'] = childrens;
          }
          for (let i = 0; i < childrens.length; i++) {
            order(list, childrens[i]);
          }
        }
        return tree;
      };
      let set = (list) => {
        for (let i = 0; i < list.length; i++) {
          this.createNode({
            n_addional: list[i].n_addional,
            n_value: list[i].n_id,
            n_title: list[i].n_title,
            n_id: list[i].n_id,
            n_elements: list[i].n_elements,
            n_parent: this.getNode(list[i].n_parentid),
            n_checkStatus:
              typeof list[i].n_checkStatus === 'undefined'
                ? false
                : list[i].n_checkStatus,
          });
          if (list[i].Child) {
            set(list[i].Child);
          }
        }
      };
      set(order(this.data));
    }
    if (this.drawCallback !== undefined) this.drawCallback();
  }
drawData ( ) { if ( this . data . length > 0 ) { let order = ( list , p = { n_id : 0 , Child : [ ] } , tree = [ ] ) => { let childrens = list . filter ( ( y ) => y . n_parentid === p . n_id ) ; if ( childrens . length > 0 ) { if ( p . n_id === 0 ) { tree = childrens ; } else { p [ 'Child' ] = childrens ; } for ( let i = 0 ; i < childrens . length ; i ++ ) { order ( list , childrens [ i ] ) ; } } return tree ; } ; let set = ( list ) => { for ( let i = 0 ; i < list . length ; i ++ ) { this . createNode ( { n_addional : list [ i ] . n_addional , n_value : list [ i ] . n_id , n_title : list [ i ] . n_title , n_id : list [ i ] . n_id , n_elements : list [ i ] . n_elements , n_parent : this . getNode ( list [ i ] . n_parentid ) , n_checkStatus : typeof list [ i ] . n_checkStatus === 'undefined' ? false : list [ i ] . n_checkStatus , } ) ; if ( list [ i ] . Child ) { set ( list [ i ] . Child ) ; } } } ; set ( order ( this . data ) ) ; } if ( this . drawCallback !== undefined ) this . drawCallback ( ) ; }
this method will draw multiple data
this method will draw multiple data
//start loading //if data is exist //first reshape data //then create nodes //start chain //start drawcallback //end loading