[Help] select item Tree from a method instead of a click - hightLightSelectedNode

UI Components for Vue
Post Reply
xvadimxt
Posts: 6
Joined: 15 Feb 2021, 15:28

29 Mar 2021, 17:10

Tree

https://primefaces.org/primevue/showcase/#/tree

Code: Select all

<Tree v-if="allStructuresTree.length > 0"
      style="padding:0px;width: 100%;display: flex;"
        filterMode="strict"
        :value="allStructuresTree"
        :loading="loadingPrime"
        ref="tree"
        selectionMode="single"
       v-model:selectionKeys="selectedKey2"
        :metaKeySelection="true"
        @nodeSelect="onCurrentNodeChanged"
      >
      
Is not working

Code: Select all

this.selectedKey2 = id;
Clear selection is not working because you can't set this object.

Code: Select all

this.$refs.tree.selectionKeys = {}
How can i hightLightSelectedNode from a method ?

For example:

Code: Select all

hightLightSelectedNode(node) {
this.$refs.tree. ????(node)
}

Code: Select all

this.$refs.tree.selectionKeys[this.$data.currentStructureItem.key] = false
      this.$data.currentStructureItem = itemInTree;
      this.$refs.tree.selectionKeys[itemInTree.key] = true
I have solved this by this way but i need to hightLightSelectedNode, how can i do it ?

p-treenode-content p-treenode-selectable p-highlight

and how can i get the element in the DOM without an id ?
not document.querySelector(".p-highlight");

Post Reply

Return to “PrimeVue”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 8 guests