Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

mat-virtual-table

Package Overview
Dependencies
Maintainers
1
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mat-virtual-table

Virtual scroll table based on angular material, with sticky columns, filtering ,sorting and resizing columns.

latest
Source
npmnpm
Version
9.0.2
Version published
Weekly downloads
106
5200%
Maintainers
1
Weekly downloads
 
Created
Source

Virtual scroll angular material table

Virtual scroll table based on angular material, with sticky columns, filtering ,sorting and resizing columns.

Getting Started

Install

run npm i mat-virtual-table

Import module

import {TableModule} from 'mat-virtual-table';
@NgModule({
    imports: [
            FormsModule,
            ReactiveFormsModule,
            MaterialModule,
            CommonModule,
            FlexLayoutModule,
            RouterModule,
            TableModule,
    ],
    declarations: components,
    exports: [TableModule, MaterialModule, FlexLayoutModule].concat(components),
})
export class ComponentsModule { }

Simple usage

 <mat-virtual-table [rows]="rows">

Column titles

 <mat-virtual-table [rows]="rows" [columnsDef]="columns">

example

Special cells

<mat-virtual-table [rows]="rows" [columnsDef]="columns">
    <ng-template pCellDef column="name" let-row="row">
        <b>{{row.name}}</b>
    </ng-template>
</mat-virtual-table>

example

Resizing columns

resize column with rtl support.

Pagination

Set paginator true to add paginator.

<mat-virtual-table [rows]="rows" [paginator]="true">
</mat-virtual-table>

to custom lables, use CustomMatPaginatorIntl:

export class CustomMatPaginatorIntl extends MatPaginatorIntl {
  nextPageLabel = 'הבא';
  previousPageLabel = 'קודם';
  getRangeLabel = (page, pageSize, length) => {
    if (length === 0 || pageSize === 0) {
      return '0 מתוך ' + length;
    }
    length = Math.max(length, 0);
    const startIndex = page * pageSize;
    const endIndex = startIndex < length ?
      Math.min(startIndex + pageSize, length) :
      startIndex + pageSize;
    return startIndex + 1 + ' - ' + endIndex + ' מתוך ' + length;
  };
}

example.

Api

@Input() rows; // table rows.
@Input() columnsDef; // columns definitions. each column it could be define title, isSortable, isFilterable, and width. default width is calculated by max value length.
@Input() isFilterable = true; // true by default, and filter all columns, Unless otherwise specified in the columnsDef.
@Input() filterPlaceholder = 'Filter';  
@Input() isResizable = true; // true by default, rtl support. be aware that there is performace issue without build with production mode.
@Input() itemSize = 47;
@Input() headerSize = 56;
@Input() pageSize = 50;
@Input() paginator: boolean;

Keywords

virtual-scroll

FAQs

Package last updated on 06 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts