0.1.4 • Published 6 months ago

cognitable v0.1.4

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

Cognitable - Angular Datatable

This project was generated with Angular CLI version 18.2.3.

Recommended Platforms to Use

  1. Angular >= 18

Install Cognitable using NPM

npm install cognitable

Start using Cognitable

HTML

<cognitable #cognitable
            [tableHeaders]="headers"
            [paginationEnabled]="true"
            (cellContentClicked)="clicked($event)"
></cognitable>

Component Class

Get Reference of the Table

Any further operations will be done using this

@ViewChild('cognitable') cognitable: CognitableComponent | undefined;

Declaring Headers

This can be directly given in the HTML attribute

headers: TableHeader[] = [
    {
        title: 'Supplier Name',
        field: 'supplierName',
        sort: {
            enabled: true
        },
        styles: {
            cellStyles: {
                color: '#1E40AE',
                cursor: 'pointer'
            }
        }
    },
    {
        title: 'Supplier Type',
        field: 'supplierType'
    },
    {
        title: 'Address',
        field: 'address'
    },
    {
        title: 'Status',
        field: 'status',
        renderer: {
            component: StatusDropdownComponent
        }
    }
];

Set Data to the table

this.cognitable?.setTableData(data);

Search over the whole data in the table

this.cognitable?.filter(this.searchText);

Render Custom Component in Cells

Implement CellRenderer in the custom component

export class StatusDropdownComponent implements CellRenderer {
    // Your logic
}

And the in headers

headers: TableHeader[] = [
    // Other Headers (if any)
    {
        title: 'Status',
        field: 'status',
        renderer: {
            component: StatusDropdownComponent
        }
    }
    // Other Headers (if any)
];

REMEMBER

This library is on its birth stage, we will be adding more updates very soon on the go.

You are welcomed to contribute more into it on https://github.com/cognitable/cognitable

0.1.4

6 months ago

0.1.2

8 months ago

0.1.3

8 months ago

0.1.1

9 months ago

0.1.0

9 months ago

0.0.18

9 months ago

0.0.17-BETA

9 months ago

0.0.16-BETA

9 months ago

0.0.15-BETA

9 months ago

0.0.14-BETA

9 months ago

0.0.13-BETA

9 months ago

0.0.12-BETA

9 months ago

0.0.11-BETA

9 months ago

0.0.10-BETA

9 months ago

0.0.9-BETA

9 months ago

0.0.8-BETA

9 months ago

0.0.7-BETA

9 months ago

0.0.5-BETA

9 months ago

0.0.4-BETA

9 months ago

0.0.3-BETA

9 months ago

0.0.2-BETA

9 months ago

0.0.1

10 months ago