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