Skip to content
Snippets Groups Projects
Commit 08fa4804 authored by Dietmar Theinert's avatar Dietmar Theinert
Browse files

[SI-2944] - correct filtering for stations

parent 858d5de5
No related branches found
No related tags found
No related merge requests found
...@@ -243,7 +243,7 @@ describe('SetFilterComponent', () => { ...@@ -243,7 +243,7 @@ describe('SetFilterComponent', () => {
component['_valueGetter'] = () => 'oncle tom'; component['_valueGetter'] = () => 'oncle tom';
component.setItems = { oncle: { checked: true } }; component.setItems = { oncle: { checked: true } };
const returnValue = component.doesFilterPass({} as any); const returnValue = component.doesFilterPass({} as any);
expect(returnValue).toBeFalsy(); expect(returnValue).toBeTruthy();
}); });
it('should set params via agInit()', () => { it('should set params via agInit()', () => {
......
...@@ -89,8 +89,28 @@ export class SetFilterComponent implements AgFilterComponent, OnDestroy { ...@@ -89,8 +89,28 @@ export class SetFilterComponent implements AgFilterComponent, OnDestroy {
} }
doesFilterPass(params: IDoesFilterPassParams): boolean { doesFilterPass(params: IDoesFilterPassParams): boolean {
const itemKey = this._valueGetter(params.node); const nodeValue = this._valueGetter(params.node);
return this.setItems[itemKey || null] !== undefined && this.setItems[itemKey || null].checked; let passed: boolean = false;
for (let itemKey in this.setItems) {
if (isNaN(nodeValue)) {
if (itemKey === 'null') {
passed = !nodeValue || nodeValue === ''; // nodeValue is falsy or empty string
} else {
passed = !!nodeValue && nodeValue.includes(itemKey);
}
} else {
// is numeric or null
if (!nodeValue) {
passed = nodeValue === null && itemKey === 'null';
} else {
passed = nodeValue.toString() === itemKey;
}
}
passed = passed && this.setItems[itemKey].checked;
if (passed) return passed;
}
return passed;
} }
getModel(): any { getModel(): any {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment