Skip to content

Releases: ssuperczynski/ngx-easy-table

2.2.0

08 Jan 10:22
Compare
Choose a tag to compare

Option to hide pagination dropdown range.
To enable it add paginationRangeEnabled parameter to your config service

import { Injectable } from '@angular/core';
import { Config } from './ngx-easy-table/model/config';

@Injectable()
export class ConfigService {
  public static config: Config = {
    searchEnabled: true,
    headerEnabled: true,
    orderEnabled: true,
    globalSearchEnabled: true,
    paginationEnabled: true,
    exportEnabled: false,
    clickEvent: true,
    selectRow: false,
    selectCol: false,
    selectCell: false,
    rows: 10,
    additionalActions: false,
    serverPagination: false,
    isLoading: false,
    detailsTemplate: false,
    groupRows: false,
    paginationRangeEnabled: true, // <-- here
  };
}

2.1.0

28 Nov 07:02
Compare
Choose a tag to compare

Configs model has new path:

Before:

import { Config } from 'ngx-easy-table/app/model/config';

After:

import { Injectable } from '@angular/core';
import { Config } from 'ngx-easy-table/src/app/ngx-easy-table/model/config';

@Injectable()
export class ConfigService {
  public static config: Config = {
    searchEnabled: false,
    headerEnabled: true,
    orderEnabled: false,
    globalSearchEnabled: false,
    paginationEnabled: true,
    exportEnabled: false,
    clickEvent: false,
    selectRow: true,
    selectCol: false,
    selectCell: false,
    rows: 5,
    additionalActions: false,
    serverPagination: true,
    isLoading: false,
    detailsTemplate: true,
    groupRows: false
  };
}

2.0.0

24 Nov 12:21
ceacf9b
Compare
Choose a tag to compare
  • Angular 5 support
  • Group rows
<ngx-table
  [configuration]="configuration"
  [data]="data"
  [columns]="columns"
  [groupRowsBy]="'age'"
  [pagination]="pagination">
</ngx-table>

1.8.0

16 Nov 17:19
4b965d9
Compare
Choose a tag to compare
  • row details

If you have more details than row can handle, you can put them into row details, and toggle when needed.

app.component.html

<ngx-table
  [configuration]="configuration"
  [data]="data"
  [columns]="columns"
  [detailsTemplate]="detailsTemplateRef"
  [pagination]="pagination">
</ngx-table>
<ng-template #detailsTemplate let-row>
  <div>
    <h2 class="color-green">{{row.company }}</h2>
    {{row.firstname }} {{row.lastname}}
    <hr>
    <span class="fa fa-address-card-o" aria-hidden="true"> </span> {{row.created | date}}
  </div>
</ng-template>

app.component.ts

export class AppComponent implements OnInit {
  @ViewChild('detailsTemplate') detailsTemplateRef: TemplateRef<any>;
}

1.7.1

15 Nov 13:15
Compare
Choose a tag to compare
  • Server pagination
  • Server sorting
  • Breaking change: removed http module, to pass data to the table use [data] and [columns]:
<ngx-table 
  [configuration]="configuration"
  [data]="data"
  [columns]="columns"
  [pagination]="pagination"
  (event)="eventEmitted($event)">
</ngx-table>
  data = [
    { id: 1, age: 34, name: 'John Black', company: 'FooBar'},
    { id: 2, age: 24, name: 'Lucy Black', company: 'FooBar'},
    { id: 3, age: 23, name: 'John White', company: 'FooBar'},
  ];
  columns = [
    { key: 'id', title: 'ID' },
    { key: 'age', title: 'Age' },
    { key: 'name', title: 'Name' },
    { key: 'company', title: 'Company' }
  ];
  • Breaking change: new config schema:
import { Injectable } from '@angular/core';
import { Config } from 'ngx-easy-table/app/model/config';

@Injectable()
export class ConfigService {
  public static config: Config = {
    searchEnabled: false,
    headerEnabled: false,
    orderEnabled: false,
    globalSearchEnabled: false,
    paginationEnabled: true,
    exportEnabled: false,
    clickEvent: false,
    selectRow: true,
    selectCol: false,
    selectCell: false,
    rows: 10,
    additionalActions: false,
    serverPagination: true,
    isLoading: false,
  };
}

1.7.0

13 Nov 21:18
4eac8fe
Compare
Choose a tag to compare
1.7.0 Pre-release
Pre-release
server pagination and sorting

1.6.0

31 Oct 09:56
69b97b8
Compare
Choose a tag to compare

Breaking change.

before:
<ng2-table></ng2-table>

after:
<ngx-table></ngx-table>

Custom sort This option is removed in 2.0

  sortBy(key, order): void {
    this.sort = {
      key: key,
      order: order,
    };
  }
<div>
  <button class="dropdown" (click)="sortBy('created', 'asc')">Created asc</button>
  <button class="dropdown" (click)="sortBy('created', 'desc')">Created desc</button>
  <button class="dropdown" (click)="sortBy('id', 'asc')">ID</button>
</div>
<ngx-table
  [configuration]="configuration"
  [filters]="filters"
  [sort]="sort">
</ngx-table>

Custom css styles:

Add custom styles to table:

  • ngx-table__header
  • ngx-table__header-cell
  • ngx-table__header-cell-additional-actions
  • ngx-table__sortHeader
  • ngx-table__body-empty
  • ngx-table__footer
  • ngx-table__global-search
  • ngx-table__header-search
  • ngx-table__table-menu
  • ngx-icon-menu
  • ngx-icon ngx-icon-arrow-up
  • ngx-icon ngx-icon-arrow-down
  • ngx-menu-item
  • ngx-pagination
  • ngx-page-item

1.5.0

28 Oct 08:17
Compare
Choose a tag to compare

Add style to row template

https://ngx-easy-table.stackblitz.io/template

Table for basic styles uses awesome Spectre.css - https://picturepan2.github.io/spectre.
Each class has prefix ngx- so you can easy customise table to you project.
If you use angular-cli just add basic styles to angular-cli.json:

"styles": [
    "../node_modules/ngx-easy-table/spectre.css",
    "../node_modules/ngx-easy-table/spectre-icons.css",
  ],

If you use just Angular without CLI, add above .css files as @import "~ngx-easy-table/spectre.css" to your basic style.css file or to .

If you would like to use your own styles just go to https://picturepan2.github.io/spectre/getting-started.html#custom
Customise Spectre.css (colors, marings, shadows etc). Then scroll to Custom prefix section and add prefix ngx- (this is because Spectre uses same classes as many other css frameworks).
By adding prefix you will use just spectre styles and vice versa. Spectre won't overwrite your app styles.

At the end run gulp run build and gulp run prefix and add it to you page.

1.4.0

27 Oct 13:43
Compare
Choose a tag to compare

Custom filters

This option is removed in 2.0

Create filter outside table and pass them to the table:

<input type="checkbox"
       id="showOpenCompanies"
       [checked]="isChecked"
       (change)="showOpenCompanies()">
<label for="showOpenCompanies">Show open companies</label>

<input type="range" min="1" max="10000"
       id="filterByAmount"
       (input)="filterByAmount($event.target.value)">
<label for="filterByAmount">filter by amount</label>

<ng2-table
  [configuration]="configuration"
  [filters]="filters"
</ng2-table>
  public filters = {};
  ngOnInit() {}
  showOpenCompanies() {
    this.filters['status'] = {
      value: 2, // 2 means open company (from database)
      query: '=',
    };
    this.filters = Object.assign({}, this.filters);
  }

  filterByAmount(value) {
    this.filters['amount'] = {
      value: value,
      query: '>',
    };
    this.filters = Object.assign({}, this.filters);
  }

1.3.6

23 Oct 14:03
Compare
Choose a tag to compare

1. Pass data to table by creating custom array: This option has been changed in 2.0

https://ngx-easy-table.stackblitz.io/custom-array

const array = [{'foo': 'bar'}, {'foo': 'baz'}];
this.configuration.data = array;

2. Pass custom headers to url, for example when you deal with OAuth2 and your request requires additional headers: Removed in 2.0

const headers = new HttpHeaders({ 'Authorization': 'Bearer token' });
this.configuration.httpHeaders = array;