Revision 60315
Added by Konstantinos Triantafyllou about 3 years ago
divIds.component.ts | ||
---|---|---|
51 | 51 |
keyword: [''], |
52 | 52 |
type: ['all', Validators.required]}); |
53 | 53 |
this.subscriptions.push(this.filterForm.get('keyword').valueChanges.subscribe(value => { |
54 |
this.filterBySearch(value); |
|
54 |
this.searchText = new RegExp(value, 'i'); |
|
55 |
this.applyFilters(); |
|
55 | 56 |
})); |
56 | 57 |
this.subscriptions.push(this.filterForm.get('type').valueChanges.subscribe(value => { |
57 |
this.applyTypeFilter();
|
|
58 |
this.applyFilters();
|
|
58 | 59 |
})); |
59 | 60 |
this.getDivIds(); |
60 | 61 |
this.subscriptions.push(this.route.queryParams.subscribe(params => { |
... | ... | |
128 | 129 |
let i = this.divIds.findIndex(_ => _._id == id); |
129 | 130 |
this.divIds.splice(i, 1); |
130 | 131 |
} |
131 |
this.applyTypeFilter(); |
|
132 |
this.applyFilter(); |
|
132 |
this.applyFilters(); |
|
133 | 133 |
} |
134 | 134 |
|
135 | 135 |
public confirmDeleteDivId(id: string) { |
... | ... | |
264 | 264 |
|
265 | 265 |
public divIdSavedSuccessfully(divId: DivId) { |
266 | 266 |
this.divIds.push(divId); |
267 |
this.applyTypeFilter(); |
|
268 |
this.applyFilter(); |
|
267 |
this.applyFilters(); |
|
269 | 268 |
this.applyCheck(false); |
270 | 269 |
} |
271 | 270 |
|
272 | 271 |
public divIdUpdatedSuccessfully(divId: DivId) { |
273 | 272 |
this.divIds[this.index] = divId; |
274 |
this.applyTypeFilter(); |
|
275 |
this.applyFilter(); |
|
273 |
this.applyFilters(); |
|
276 | 274 |
this.applyCheck(false); |
277 | 275 |
} |
278 | 276 |
|
279 |
public filterBySearch(text: string) { |
|
280 |
this.searchText = new RegExp(text, 'i'); |
|
281 |
this.applyFilter(); |
|
282 |
} |
|
283 |
|
|
284 |
public applyFilter() { |
|
277 |
public applyFilters() { |
|
285 | 278 |
this.checkboxes = []; |
286 |
this.divIds.filter(item => this.filterDivIds(item)).forEach( |
|
287 |
_ => this.checkboxes.push(<CheckDivId>{divId: _, checked: false}) |
|
288 |
); |
|
289 |
} |
|
290 |
public applyTypeFilter() { |
|
291 |
this.checkboxes = []; |
|
292 | 279 |
this.divIds.filter(item => this.filterByType(item)).forEach( |
293 |
_ => this.checkboxes.push(<CheckDivId>{divId: _, checked: false})
|
|
280 |
item => this.checkboxes.push(<CheckDivId>{divId: item, checked: false})
|
|
294 | 281 |
); |
282 |
this.checkboxes = this.checkboxes.filter(item => this.filterDivIds(item.divId)); |
|
295 | 283 |
} |
296 | 284 |
|
297 | 285 |
public filterByType(divId: DivId): boolean { |
Also available in: Unified diff
[Libraryr | Trunk]: Fix filters on admin tools pages