1.0.5 • Published 4 years ago

group-tree-list v1.0.5

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

A treeview component for Bootstrap and Vue.js 2.0+

Bootstrap-Vue-Treeview Screenshot

Online demo

https://bootstrap-vue-treeview.appdiamond.pl

Features

  • Drag & drop nodes
  • Context menu

Installation

npm install --save bootstrap-vue-treeview

Getting started

Webpack

If you use Webpack bundler (recommended) you can import component and register it locally:

import { bTreeView } from 'bootstrap-vue-treeview'
[...]
components: {
	bTreeView
},

or globally using plugin:

import BootstrapVueTreeview from 'bootstrap-vue-treeview'
Vue.use(BootstrapVueTreeview)

Now you can you the treeview component in your code:

<b-tree-view :data="treeData"></b-tree-view>
export default {
  data() {
    return {
      treeData: [{"id": 2, "name": "Venus" , "children": [{"id": 3, "name": "Neptune"}, {"id": 4, "name": "Stratus"} ] } ]
    }
  }
}

API

TreeView

1. Vue props

PropTypeDescriptionDefault valueRequired
dataArrayTree data-Yes
nodeKeyPropStringName of the property containing unique node key"id"No
nodeChildrenPropStringWhere to look for node children"children"No
nodeLabelPropStringName of the property containing node label"name"No
showIconsBooleanShow/hide iconsfalseNo
iconClassPropStringName of the property containing icon class"icon"No
defaultIconClassStringIcon class to apply if node has no icon class propertynullNo
prependIconClassStringClass to apply to every icon (common to all icons)nullNo
nodesDraggableBooleanEnable/disable drag & drop featurefalseNo
contextMenuBooleanEnable/disable context menutrueNo
renameNodeOnDblClickBooleanEnable/disable double click to rename featuretrueNo
contextMenuItemsArray of menu itemsContext menu items { code: 'DELETE_NODE', label: 'Delete node' }, { code: 'RENAME_NODE', label: 'Rename node' } No

2. Events

Event nameDescriptionParameters
nodeSelectTriggered every time a node is selected/deselected. Check second parameter to verify if the node was selected or deselectedTreeNode object, isSelected
contextMenuItemSelectTriggered every time a context menu item was clicked.Context menu item object (see below), TreeNode object

TreeNode

Props and events of the tree node component are not intended to be used directly.

1. Methods

Method nameDescriptionParameters
selectSelect node-
deselectDeselect node-
expandExpand node (show children)-
collapseCollapse node (hide children)-
toggleExpand/collapse-

Menu item

1. Properties

PropertyDescription
codeCode of the menu item. Check this code to know which menu item was clicked.
labelLabel being displayed for the user
1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago