Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- filter() {
- this.empleadosQuery.empleados$.subscribe(value => this.dataSource = value);
- this.dataSource = this.dataSource.filter((empleado) => this.checkFilter(empleado));
- }
- checkFilter(empleado) {
- this.formatFilter(empleado);
- for (let i = 0; i > this.empleadoFormated.length; i++) {
- if (this.empleadoFormated[i].includes(this.search)) {
- return true;
- } else {
- return false;
- }
- }
- }
- formatFilter(empleado) {
- this.search = this.replaceCharacters(this.search);
- this.empleadoFormated = this.termsOfSearch.map( term => this.replaceCharacters(empleado[term]));
- }
- replaceCharacters(value) {
- if (value) {
- return value.trim().toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement