npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ng-treetable

v1.3.3

Published

Tree table component for angular 2+.

Downloads

1,004

Readme

Angular 2 Style Guide MIT license

Tree Table component for Angular

A tree table component for Angular, based on Primeng treetable.

Getting Started

npm install --save ng-treetable

Demo

Live Demo

Configuration

Angular cli

After installation, no additional configuration is needed. Import the TreeTableModule and define it as one of the imports of your application module:

import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {TreeTableModule} from "ng-treetable";

import {AppComponent} from './app.component';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        TreeTableModule
    ],
    bootstrap: [
        AppComponent
    ]
})
export class AppModule {}

Data type

{
    "data":
    [  
        {  
            "data":{  
                "name":"Andrew",
                "gender":"Male"
            },
            "children":[
                {  
                    "data":{  
                        "name":"Andrewson",
                        "gender":"Male"
                    },
                    "children":[  
                        {  
                            "data":{  
                                "name":"Eric",
                                "gender":"Male"
                            }
                        }                       
                    ]
                }
            ]
        }
    ]
}

Examples

Basic

<ay-treeTable [value]="data">
    <ay-column field="name" header="Name"></ay-column>
    <ay-column field="gender" header="Gender"></ay-column>
</ay-treeTable>

Paginator

<ay-treeTable [value]="data" [rows]="10" [paginator]="true" [pageLinks]="3" [rowsPerPageOptions]="[5,10,20]">
    <ay-column field="name" header="Name"></ay-column>
    <ay-column field="gender" header="Gender"></ay-column>
</ay-treeTable>

Filter

<input #gb type="text" pInputText size="50" placeholder="Global Filter">
<ay-treeTable [value]="data" [globalFilter]="gb" [rows]="10" [paginator]="true" [pageLinks]="3" [rowsPerPageOptions]="[5,10,20]">
    <ay-column field="name" header="Name"></ay-column>
    <ay-column field="gender" header="Gender"></ay-column>
</ay-treeTable>

Input properties

| Name | Type | Default | Description | |-------------------- |--------- |---------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | value | array | null | An array of treenodes. | | rows | number | null | Number of rows to display per page. | | paginator | boolean | false | When specified as true, enables the pagination. | | totalRecords | number | null | Number of total records, defaults to length of value when not defined. | | pageLinks | number | 5 | Number of page links to display in paginator. | | rowsPerPageOptions | array | null | Array of integer values to display inside rows per page dropdown of paginator | | immutable | boolean | false | Improves performance by avoiding diff checking, changes to value should be done in an immutable way on application side when immutable property is enabled. | | globalFilter | any | null | Reference of an input field to use as a global filter. | | filterDelay | number | 300 | Delay in milliseconds before filtering the data. | | labelExpand | string | Expand | Tooltip and screenreader text for expand icon. | | labelCollapse | string | Collapse | Tooltip and screenreader text for collapse icon. | | selectionMode | string | null | Defines the selection mode, valid values "single" and "multiple". | | selection | any | null | A single treenode instance or an array to refer to the selections. | | style | string | null | Inline style of the component. | | styleClass | string | null | Style class of the component. | | metaKeySelection | boolean | true | Defines how multiple items can be selected, when true metaKey needs to be pressed to select or unselect an item and when set to false selection of each item can be toggled individually. On touch enabled devices, metaKeySelection is turned off automatically. |

Events

| Name | Parameters | Description | |---------------------|---------------------------------------------------------------------------|--------------------------------------------------------------| | onNodeSelect | event.originalEvent: browser event event.node: Selected node instance. | Callback to invoke when a node is selected. | | onNodeUnselect | event.originalEvent: browser event event.node: Unselected node instance. | Callback to invoke when a node is unselected. | | onNodeExpand | event.originalEvent: browser event event.node: Expanded node instance. | Callback to invoke when a node is expanded. | | onNodeCollapse | event.originalEvent: browser event event.node: Collapsed node instance. | Callback to invoke when a node is collapsed. | | onContextMenuSelect | event.originalEvent: browser event event.node: Selected node instance. | Callback to invoke when a node is selected with right click. |