FilterFix/Done
parent
b90d429a8e
commit
479fe7ce09
|
|
@ -156,37 +156,33 @@ export class MultiselectAutocompleteComponent implements OnInit {
|
||||||
|
|
||||||
public toggleAll(): void {
|
public toggleAll(): void {
|
||||||
this.allSelected = !this.allSelected;
|
this.allSelected = !this.allSelected;
|
||||||
if(this.allSelected == false){
|
|
||||||
//console.log('####false'+this.allSelected);
|
if (this.allSelected) {
|
||||||
for (const item of this.rawData) {
|
for (const item of this.rawData) {
|
||||||
item.selected = false;
|
const filterExists = this.selectData.some(selectedItem => selectedItem.item === item.item);
|
||||||
|
|
||||||
const i = this.selectData.findIndex(value => value.item === item.item);
|
if (!filterExists) {
|
||||||
this.selectData.splice(i, 1);
|
|
||||||
|
|
||||||
this.selectControl.setValue(this.selectData);
|
|
||||||
|
|
||||||
//this.toggleSelection({'item': item.item, 'selected': false});
|
|
||||||
}
|
|
||||||
this.emitAdjustedData();
|
|
||||||
}else{
|
|
||||||
//console.log('####true'+this.allSelected);
|
|
||||||
for (const item of this.rawData) {
|
|
||||||
item.selected = true;
|
item.selected = true;
|
||||||
|
|
||||||
this.selectData.push(item);
|
this.selectData.push(item);
|
||||||
this.selectControl.setValue(this.selectData);
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (const item of this.rawData) {
|
||||||
|
const index = this.selectData.findIndex(selectedItem => selectedItem.item === item.item);
|
||||||
|
|
||||||
//this.toggleSelection({'item': item.item, 'selected': true});
|
if (index !== -1) {
|
||||||
|
item.selected = false;
|
||||||
|
this.selectData.splice(index, 1);
|
||||||
}
|
}
|
||||||
// for (let rawItem of this.rawData) {
|
}
|
||||||
// rawItem.selected = false;
|
}
|
||||||
// }
|
|
||||||
|
this.selectControl.setValue(this.selectData);
|
||||||
this.emitAdjustedData();
|
this.emitAdjustedData();
|
||||||
}
|
|
||||||
this.evaluateIndeterminate();
|
this.evaluateIndeterminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public showCheckBox(): void{
|
public showCheckBox(): void{
|
||||||
this.showCheckbox = true;
|
this.showCheckbox = true;
|
||||||
//console.log("####")
|
//console.log("####")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue