showOnly(requiredNodeIds) {
    this.load().then(allNodeIds => {
      let shownNodeIds = []
      let hiddenNodeIds = []
      for (let nodeId of allNodeIds) {
        if(requiredNodeIds.indexOf(nodeId) !== -1) {
          let node = this.jstree.get_node(nodeId)
          shownNodeIds.push(nodeId)
          if (node.children_d) shownNodeIds = shownNodeIds.concat(node.children_d)
          if (node.parents) shownNodeIds = shownNodeIds.concat(node.parents)
        } else {
          hiddenNodeIds.push(nodeId)
        }
      }
      // using setTimeout to delay DOM modifications (reducing UI blocking)
      setTimeout(() => {
        for (let nodeId of hiddenNodeIds) {
          if(!Arrays.contains(shownNodeIds, nodeId)) {
            this.jstree.hide_node(nodeId)
            this.jstree.deselect_node(nodeId)
          }
        }
      }, 0)
      setTimeout(() => {
        for (let nodeId of shownNodeIds) {
          this.jstree.show_node(nodeId)
        }
      }, 0)
    })
  }
/**
  * Hide all nodes except the given nodes, their parents and their children
  */
Hide all nodes except the given nodes, their parents and their children
Hide all nodes except the given nodes their parents and their children
showOnly(requiredNodeIds) {
    this.load().then(allNodeIds => {
      let shownNodeIds = []
      let hiddenNodeIds = []
      for (let nodeId of allNodeIds) {
        if(requiredNodeIds.indexOf(nodeId) !== -1) {
          let node = this.jstree.get_node(nodeId)
          shownNodeIds.push(nodeId)
          if (node.children_d) shownNodeIds = shownNodeIds.concat(node.children_d)
          if (node.parents) shownNodeIds = shownNodeIds.concat(node.parents)
        } else {
          hiddenNodeIds.push(nodeId)
        }
      }
      setTimeout(() => {
        for (let nodeId of hiddenNodeIds) {
          if(!Arrays.contains(shownNodeIds, nodeId)) {
            this.jstree.hide_node(nodeId)
            this.jstree.deselect_node(nodeId)
          }
        }
      }, 0)
      setTimeout(() => {
        for (let nodeId of shownNodeIds) {
          this.jstree.show_node(nodeId)
        }
      }, 0)
    })
  }
showOnly ( requiredNodeIds ) { this . load ( ) . then ( allNodeIds => { let shownNodeIds = [ ] let hiddenNodeIds = [ ] for ( let nodeId of allNodeIds ) { if ( requiredNodeIds . indexOf ( nodeId ) !== - 1 ) { let node = this . jstree . get_node ( nodeId ) shownNodeIds . push ( nodeId ) if ( node . children_d ) shownNodeIds = shownNodeIds . concat ( node . children_d ) if ( node . parents ) shownNodeIds = shownNodeIds . concat ( node . parents ) } else { hiddenNodeIds . push ( nodeId ) } } setTimeout ( ( ) => { for ( let nodeId of hiddenNodeIds ) { if ( ! Arrays . contains ( shownNodeIds , nodeId ) ) { this . jstree . hide_node ( nodeId ) this . jstree . deselect_node ( nodeId ) } } } , 0 ) setTimeout ( ( ) => { for ( let nodeId of shownNodeIds ) { this . jstree . show_node ( nodeId ) } } , 0 ) } ) }
Hide all nodes except the given nodes, their parents and their children
Hide all nodes except the given nodes their parents and their children
// using setTimeout to delay DOM modifications (reducing UI blocking)