All Projects → leovo2708 → Ngx Treeview

leovo2708 / Ngx Treeview

Licence: mit
An Angular treeview component with checkbox

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Ngx Treeview

Vue Treeselect
A multi-select component with nested options support for Vue.js
Stars: ✭ 2,347 (+652.24%)
Mutual labels:  tree, component, dropdown
Vuejs Tree
A highly customizable and blazing fast Vue tree component ⚡🌲
Stars: ✭ 211 (-32.37%)
Mutual labels:  tree, component, treeview
Liquor Tree
Tree component based on Vue.js
Stars: ✭ 348 (+11.54%)
Mutual labels:  tree, component, treeview
android-thinkmap-treeview
Tree View; Mind map; Think map; tree map; custom view; 自定义;关系图;树状图;思维导图;组织机构图;层次图
Stars: ✭ 314 (+0.64%)
Mutual labels:  tree, treeview
Graphview
Flutter GraphView is used to display data in graph structures. It can display Tree layout, Directed and Layered graph. Useful for Family Tree, Hierarchy View.
Stars: ✭ 152 (-51.28%)
Mutual labels:  tree, treeview
vuejs-tree
A highly customizable and blazing fast Vue tree component ⚡🌲
Stars: ✭ 310 (-0.64%)
Mutual labels:  tree, treeview
Vue Finder
📁 A Vue.js component to display hierarchical data (like the MacOS X finder)
Stars: ✭ 87 (-72.12%)
Mutual labels:  tree, treeview
tree-tree
No description or website provided.
Stars: ✭ 15 (-95.19%)
Mutual labels:  tree, treeview
comment tree
Render comment tree like facebook comment - reply
Stars: ✭ 37 (-88.14%)
Mutual labels:  tree, treeview
react-treefold
A renderless tree component for your hierarchical React views
Stars: ✭ 37 (-88.14%)
Mutual labels:  tree, treeview
react-super-treeview
👏 Finally, a React Treeview component which is customizable on every level
Stars: ✭ 98 (-68.59%)
Mutual labels:  checkbox, treeview
react-native-nested-listview
A UI component for React Native for representing nested arrays of N levels
Stars: ✭ 163 (-47.76%)
Mutual labels:  tree, treeview
select2-to-tree
Select2-to-Tree extends Select2 to support arbitrary level of nesting...
Stars: ✭ 71 (-77.24%)
Mutual labels:  tree, treeview
vue-virtualised
Blazing fast scrolling and updating for any amount of list and hierarchical data.
Stars: ✭ 18 (-94.23%)
Mutual labels:  tree, treeview
Wmztreeview
类似前端elementUI的树形控件,可自定义节点内容,支持无限极节点,可拖拽增删节点等等,非递归实现
Stars: ✭ 118 (-62.18%)
Mutual labels:  tree, treeview
react-tree
Hierarchical tree component for React in Typescript
Stars: ✭ 174 (-44.23%)
Mutual labels:  tree, treeview
React Click Outside
Higher Order Component that provides click outside functionality
Stars: ✭ 266 (-14.74%)
Mutual labels:  component, dropdown
Angular Tree Component
A simple yet powerful tree component for Angular (>=2)
Stars: ✭ 1,031 (+230.45%)
Mutual labels:  tree, treeview
Bootstraptable Treeview
bootstrapTable extension of treeView
Stars: ✭ 57 (-81.73%)
Mutual labels:  tree, treeview
twtree
a highly customizable tree component for vue 2
Stars: ✭ 27 (-91.35%)
Mutual labels:  tree, checkbox

ngx-treeview Build Status npm version

An Angular treeview component with checkbox

Dependencies

This component is currently supporting Bootstrap 4. If you are using Bootstrap 4 alpha 6, please downgrade to the older version 1.0.10.

You can customize CSS yourself to break down dependencies to Bootstrap.

Features

  • Unlimited tree level
  • State: disabled / collapse, expand
  • Filtering
  • Internationalization (i18n) support
  • Template
  • Checkbox with tri-state

Demo

https://leovo2708.github.io/ngx-treeview/

Installation

After install the above dependencies, install ngx-treeview via:

npm install ngx-treeview --save

Once installed you need to import our main module in your application module:

import { TreeviewModule } from 'ngx-treeview';

@NgModule({
  declarations: [AppComponent, ...],
  imports: [TreeviewModule.forRoot(), ...],
  bootstrap: [AppComponent]
})
export class AppModule {
}

Usage

Treeview:

<ngx-treeview
  [config]="config"
  [items]="items"
  (selectedChange)="onSelectedChange($event)"
  (filterChange)="onFilterChange($event)"
>
</ngx-treeview>

Treeview with dropdown:

<ngx-dropdown-treeview
  [buttonClass]="buttonClass"
  [config]="config"
  [items]="items"
  (selectedChange)="onSelectedChange($event)"
  (filterChange)="onFilterChange($event)"
>
</ngx-dropdown-treeview>

config is optional. This is the default configuration:

{
   hasAllCheckBox: true,
   hasFilter: false,
   hasCollapseExpand: false,
   decoupleChildFromParent: false,
   maxHeight: 500
}

You can change default configuration easily because TreeviewConfig is injectable.

Pipe ngxTreeview:

To map your JSON objects to TreeItem objects.

<ngx-dropdown-treeview
  [config]="config"
  [items]="items | ngxTreeview:'textField'"
  (selectedChange)="onSelectedChange($event)"
>
</ngx-dropdown-treeview>

Create a TreeviewItem:

const itCategory = new TreeviewItem({
  text: "IT",
  value: 9,
  children: [
    {
      text: "Programming",
      value: 91,
      children: [
        {
          text: "Frontend",
          value: 911,
          children: [
            { text: "Angular 1", value: 9111 },
            { text: "Angular 2", value: 9112 },
            { text: "ReactJS", value: 9113 },
          ],
        },
        {
          text: "Backend",
          value: 912,
          children: [
            { text: "C#", value: 9121 },
            { text: "Java", value: 9122 },
            { text: "Python", value: 9123, checked: false },
          ],
        },
      ],
    },
    {
      text: "Networking",
      value: 92,
      children: [
        { text: "Internet", value: 921 },
        { text: "Security", value: 922 },
      ],
    },
  ],
});

You can pass the second paramater 'autoCorrectChecked' with value=true (default is false) in constructor of TreeviewItem to correct checked value of it and all of its descendants. In some cases, you need to push or pop children flexibly, checked of parent may be not correct. Then you need to call function correctChecked() to help to correct from root to its descendants.

const vegetableCategory = new TreeviewItem({
  text: "Vegetable",
  value: 2,
  children: [
    { text: "Salad", value: 21 },
    { text: "Potato", value: 22 },
  ],
});
vegetableCategory.children.push(
  new TreeviewItem({ text: "Mushroom", value: 23, checked: false })
);
vegetableCategory.correctChecked(); // need this to make 'Vegetable' node to change checked value from true to false

TreeviewEventParser:

Extract data from list of checked TreeviewItem and send it in parameter of event selectedChange. Some built-in TreeviewEventParser:

  • DefaultTreeviewEventParser: return values of checked items.
  • DownlineTreeviewEventParser: return list of checked items in orginal order with their ancestors.
  • OrderDownlineTreeviewEventParser: return list of checked items in checked order with their ancestors. Note that: value of a leaf must be different from value of other leaves.

Templating:

See example 4 & 5.

Contributing

I am very appreciate for your ideas, proposals and found bugs which you can leave in github issues. Thanks in advance!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].