4.0.4 • Published 2 years ago

ngx-datatable-footer v4.0.4

Weekly downloads
116
License
-
Repository
-
Last release
2 years ago

ngx datatable footer

Build Status codecov npm version devDependency Status GitHub issues GitHub stars GitHub license

About

This is a footer component for extending'ngx-datatable'components.

Installation

Install through npm:

npm install --save ngx-datatable-footer

Then include in your apps module:

import { NgModule } from '@angular/core';
import { NgxDatatableFooterModule } from 'ngx-datatable-footer';

@NgModule({
  imports: [NgxDatatableFooterModule.forRoot()],
})
export class MyModule {}

Finally use in one of your apps components:

import { Component } from '@angular/core';

@Component({
  template: '<app-datatable-footer [datatable]="datatable"></app-datatable-footer>',
})
export class MyComponent {}

自定义模板

自定义页脚左侧

目前只支持全局修改页脚左侧 添加一个模板组件footer-page-statics

<ng-template
  #template
  let-rowCount="rowCount"
  let-pageSize="pageSize"
  let-selectedCount="selectedCount"
  let-curPage="curPage"
  let-offset="offset"
  let-config="config"
>
  <div
    class="page-count"
    *ngIf="rowCount > 0"
    [innerHTML]="
      '总数量' +
      rowCount +
      ' ' +
      config.labels.current +
      ((offset || 0) * pageSize + 1) +
      ' - ' +
      ((offset + 1) * pageSize > rowCount ? rowCount : (offset + 1 || 1) * pageSize) +
      ' / ' +
      rowCount +
      config.labels.line
    "
  ></div>
</ng-template>
import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { NgxDatatableFooterPageStatics } from 'ngx-datatable-footer/src/lib/models/footer.type';

@Component({
  selector: 'app-footer-page-statics',
  templateUrl: './footer-page-statics.component.html',
  styleUrls: ['./footer-page-statics.component.scss'],
})
export class FooterPageStaticsComponent implements OnInit, NgxDatatableFooterPageStatics {
  @ViewChild('template') templateRef: TemplateRef<any>;
  constructor() {}

  ngOnInit() {}
}

在模块引用的地方

import { NgModule } from '@angular/core';
import { NgxDatatableFooterModule } from 'ngx-datatable-footer';

@NgModule({
  declarations: [FooterPageStaticsComponent],
  imports: [
    NgxDatatableFooterModule.forRoot({{ pageStatics: FooterPageStaticsComponent }})
  ]
  ...
  entryComponents: [FooterPageStaticsComponent],
})
export class MyModule {}

需要把 FooterPageStaticsComponent 添加到 entryComponents 中

完全自定义

在使用的地方,如下示例,可以完全替换页脚

<ngx-datatable-footer [datatable]="datatable">
  <ng-template
    ngx-datatable-footer-template
    let-rowCount="rowCount"
    let-pageSize="pageSize"
    let-selectedCount="selectedCount"
    let-curPage="curPage"
    let-offset="offset"
  >
    <div style="padding: 5px 10px">
      <div>
        <strong>Summary</strong>
        : Gender: Female
      </div>
      <hr style="width: 100%" />
      <div>Rows: {{ rowCount }} | Size: {{ pageSize }} | Current: {{ curPage }} | Offset: {{ offset }}</div>
    </div>
  </ng-template>
</ngx-datatable-footer>

变量定义

变量说明
rowCount总行数
pageSize每页数量
selectedCount已选择数量
curPage当前页数
offset页偏移量
config配置信息 labels={ current: '当前 ',line: '行',page: '页',jumpTo: '跳转到',}
4.0.4

2 years ago

4.0.3

2 years ago

4.0.2

2 years ago

3.1.4

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

3.1.3

4 years ago

4.0.0-beta.1

4 years ago

4.0.0-beta.0

4 years ago

3.1.2

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.2

4 years ago

3.0.1

5 years ago

3.0.0

5 years ago

1.4.3

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.4

6 years ago

1.3.3

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago