File

src/lib/table-column-filter/table-column-filter.service.ts

Index

Properties
Methods
Accessors

Methods

Public setFilter
setFilter(column: string, value: string | undefined | null)
Parameters :
Name Type Optional
column string No
value string | undefined | null No
Returns : void

Properties

Public Readonly change
Default value : new BehaviorSubject<Record<string, string>>({})

Accessors

current
getcurrent()
import { Injectable } from '@angular/core';
import { FilterLike } from '@rxap/data-source/table';
import { clone } from '@rxap/utilities';
import { BehaviorSubject } from 'rxjs';

// TODO : move to rxap packages
@Injectable()
export class TableColumnFilterService implements FilterLike {
  public readonly change = new BehaviorSubject<Record<string, string>>({});
  public get current(): Record<string, string> {
    return clone(this.change.value);
  }

  public setFilter(column: string, value: string | undefined | null): void {
    const next = this.current;
    if (value) {
      next[column] = value;
    } else if (next[column]) {
      delete next[column];
    }
    this.change.next(next);
  }

}

results matching ""

    No results matching ""