How to get selected Node data
See original GitHub issueHi!
Thanks for your wonderfull library.
I see in src/lib/Node.js that events are emitted when a node is selected. How would I listen to that event to dynamically display the nodes data object into a Div?
If selectedNodeInfo() is run every time a node gets selected then this would work :
<template>
<div>
<LiquorTree :data="dirTree" :options="treeOptions" ref="tree"/>
<div >{{selected}}</div>
</div>
</template>
<script>
import LiquorTree from 'liquor-tree'
import axios from 'axios'
export default {
name: "resourceTree",
components: {
LiquorTree
},
data() {
return {
dirTree: this.getDirPaths(),
// This property should contain the selected node's Object.
selected : {},
treeOptions: {
propertyNames: {
text: 'name',
children: 'children'
}
}
}
},
created() {
this.getDirPaths()
},
methods : {
getDirPaths() {
return axios.get("http://localhost:9090/fragpaths")
.then(response => response.data)
}
},
selectedNodeInfo() {
this.selected = this.$refs.tree.findAll({state: { selected: true } })
}
}
</script>
<style scoped>
</style>
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Get the selected Node from a jstree - javascript - Stack Overflow
var data = $(yourtree).jstree().get_selected(true)[0].text;
Read more >How to retrive get_selected('full',true) attribute value
if i want to get only the selected node "id" i do: var selected = $('#tree').jstree(true).get_selected();. Now, I've tryed to use the 'full'...
Read more >Get Selected Node Data In Selected Order - GoJS
If you want a different order, I think you'll need to copy the collection to your own Array or List and sort it...
Read more >ASPxTreeList - How to get the values from a selected node on ...
I am trying to implement the TreeList and I need to be able to select a specific node and get the values (or...
Read more >TreeView.SelectedNode Property (System.Web.UI.WebControls)
The following code example demonstrates how to use the SelectedNode property to determine the value of the selected node in the TreeView control....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi! Thank for using the library 😃
I had some thought about
v-model
and checkboxes. You can update library and check it out or CDN (https://cdn.jsdelivr.net/npm/liquor-tree@0.2.15/dist/liquor-tree.umd.js) Also I’ve added examples (npm run dev and open Checkboxes page).For your example:
How do I get indeterminate nodes too?