1.1.5 • Published 6 months ago

ngx-vs-table v1.1.5

Weekly downloads
239
License
-
Repository
github
Last release
6 months ago

NgxVsTable

Demo: https://ngx-vs-table.firebaseapp.com/

Installation

You can use npm

npm i ngx-vs-table

or yarn

yarn add ngx-vs-table

How to use

Before using ngx-vs-table you have to import its module in some of your app module

import { NgxVsTableModule } from 'ngx-vs-table';

...

@NgModule({
    imports: [
        ...
        NgxVsTableModule,
        ...
    ]
})
export class AppModule {
    ...
}

Inside your component class you have to provide settings for your table. A simple configuration can be like this:

settings = {
    columns: {
        id: {
            title: '#',
            sticky: true,
            filter: {
                type: 'number'
            }
        },
        name: {
            title: 'Name',
            sortable: false,
            filter: true
        },
        position: {
            title: 'Position',
            sortFunction: (row) => {
                return row.position[0];
            },
            filter: {
                type: 'text',
                placeholder: 'Filter by position',
            }
        },
        office: {
            title: 'Office',
            filter: {
                type: 'select',
                list: [
                    {
                        title: 'Title',
                        value: 'value'
                    },
                    {
                        title: 'Title 2',
                        value: 'value2'
                    }
                ]
            }
        },
        age: {
            title: 'Age',
            filter: {
                type: 'checkbox'
            }
        },
        start: {
            title: 'Start date'
        },
        example: {
            title: 'Nested property',
            property: (row) => {
                return row.example.name
            }
        },
        actions: {
            title: 'Table actions',
            component: CustomCellComponent,
            componentOnInit: (componentInstance: CustomCellComponent, row: any) => {
                componentInstance.settings = {...}; // Set custom properties when component is created
            }
        }
    },
    trackBy: 'id',
    head: {
        sticky: true
    },
    pagination: {
        visible: true,
        perPage: 20
    },
    rowClassFunction: (row) => {
        if (row.isActive) {
            return 'active';
        }
        
        return '';
    }
};

data = [
    {
      id: 1,
      name: 'Airi Satou',
      position: 'Accountant',
      office: 'Tokyo',
      age: 33,
      start: '2008/11/28',
      salary: '162700',
      isActive: true,
      example: {
        name: 'Nested property example'
      }
    },
    {
      id: 2,
      name: 'Angelica Ramos',
      position: 'Chief Executive Officer (CEO)',
      office: 'London',
      age: 47,
      start: '2009/10/09',
      salary: '162700'
    },
    {
      id: 3,
      name: 'Ashton Cox',
      position: 'Junior Technical Author',
      office: 'San Francisco',
      age: 66,
      start: '2009/01/12',
      salary: '162700'
    },
    {
      id: 4,
      name: 'Bradley Greer',
      position: 'Software Engineer',
      office: 'London',
      age: 41,
      start: '2012/10/13',
      salary: '162700'
    },
    {
      id: 5,
      name: 'Brenden Wagner',
      position: 'Software Engineer',
      office: 'San Francisco\t',
      age: 28,
      start: '2011/06/07',
      salary: '206850'
    }
  ];

Inside a component template:

<ngx-vs-table
  [settings]="settings"
  [data]="data"
></ngx-vs-table>
1.1.5

6 months ago

1.1.4

7 months ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

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

0.2.9

5 years ago

0.2.8

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago