13.3.7 • Published 2 years ago

@coodoo/coo-table v13.3.7

Weekly downloads
15
License
MIT
Repository
github
Last release
2 years ago

coo-table

standard-readme compliant

A flexible Table for your REST-Service. Customize it to your needs as everything can be changed via Templates.

Visit our Demo Page

Table of Contents

Install

npm install @coodoo/coo-table

NPM Scripts

The following npm scripts are available:

  • npm run start is starting the Demo Application
  • npm run build-lib builds the coo-table-library

Setup

Import the CooTableModule to your Project.

Import BrowserModule and BrowserAnimationsModule, if you want to use the date-filter with animations, or NoopAnimationsModule if without.

ListingService

Inject ListingService and listen for the list$-Observable for refreshing

export class ListingComponent implements OnInit {
  constructor(private listingParameters: ListingParameters, public listingService: ListingService) {}

  ngOnInit() {
    this.listingService.list$.subscribe(() => {
      this.list();
    });
  }

  list() {
    this.loading = true;
    this.service.getListing(this.listingParameters).subscribe((listingResult: ListingResult<any>) => {
      this.rows = listingResult.results;
      this.metadata = listingResult.metadata;
      this.loading = false;
    });
  }
}

Template

Use the CooTable Component in your Templates

<coo-table [rows]="rows" [metadata]="metadata" [loading]="loading">
  <ng-template #header>
    <tr>
      <th>
        <span>#</span>
        <coo-table-sorter column="id"></coo-table-sorter>
      </th>
      <th>
        <span>name</span>
        <coo-table-sorter column="name"></coo-table-sorter>
      </th>
    </tr>
  </ng-template>

  <ng-template #filters>
    <tr>
      <td><coo-table-filter-text column="id"></coo-table-filter-text></td>
      <td><coo-table-filter-text column="name"></coo-table-filter-text></td>
    </tr>
  </ng-template>

  <ng-template #row let-row="row">
    <td>{{row.id}}</td>
    <td>{{row.name}}</td>
  </ng-template>
</coo-table>

Configuration

If routeChange is set in the Config your Url QueryParams getting updated dynamically.

Translations can be set in translations in the CooTableConfig.

  ngOnInit() {
    this.cooTableConfig.translations.of = 'von';
    this.cooTableConfig.translations.entry = 'Eintrag';
    this.cooTableConfig.translations.entries = 'Einträgen';
    this.cooTableConfig.translations.searchPlaceholder = 'Suchbegriff';
  }

License & Authors

MIT © coodoo

Klemens Kühle (klemens.kuehle@coodoo.de)

Arend Kühle (arend.kuehle@coodoo.de)

Johannes Höß (johannes.hoess@coodoo.de)

13.3.7

2 years ago

13.3.6

2 years ago

13.3.5

2 years ago

13.3.3

2 years ago

13.3.4

2 years ago

13.3.1

2 years ago

13.3.2

2 years ago

13.2.0

2 years ago

13.3.0

2 years ago

13.1.0

2 years ago

12.0.0

2 years ago

12.0.1

2 years ago

10.0.0

2 years ago

10.0.1

2 years ago

13.0.0

2 years ago

13.0.1

2 years ago

9.0.1

2 years ago

9.0.0

2 years ago

11.0.0

2 years ago

11.0.1

2 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.7-beta

5 years ago

0.0.7-alpha

5 years ago