Skip to content

Commit

Permalink
FIX: Adding/deleting a row took a long time when the filters were open (
Browse files Browse the repository at this point in the history
#1943)

No values were filled in the filters. Happened on an eagerly loaded screen with 10000 rows. The operations took about 10 sec.
  • Loading branch information
JindrichSusen committed Sep 21, 2023
1 parent 39d9b00 commit 9531951
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion frontend-html/src/model/entities/FilterConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ export class FilterConfiguration implements IFilterConfiguration {
implicitFilters: IImplicitFilter[];
@observable activeFilters: IFilter[] = [];

@computed
get activeCompleteFilters(){
return this.activeFilters.filter(x=> x.setting.isComplete);
}

registerFilteringOnOffHandler(handler: (filteringOn: boolean) => void) {
this.filteringOnOffHandlers.push(handler);
}
Expand Down Expand Up @@ -107,7 +112,7 @@ export class FilterConfiguration implements IFilterConfiguration {
return false;
}
}
for (let term of this.activeFilters) {
for (let term of this.activeCompleteFilters) {
if ((!ignorePropertyId || ignorePropertyId !== term.propertyId) &&
!this.userFilterPredicate(row, term)) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion frontend-html/src/model/entities/ListRowContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class ListRowContainer implements IRowsContainer {
.map(ordering => this.getOrderingProperty(dataView, ordering))
.filter((prop) => prop.column === "ComboBox");

const filterComboProps = this.filterConfiguration.activeFilters
const filterComboProps = this.filterConfiguration.activeCompleteFilters
.map((term) => getDataViewPropertyById(this.filterConfiguration, term.propertyId)!)
.filter((prop) => prop.column === "ComboBox");
const allComboProps = Array.from(new Set(filterComboProps.concat(orderingComboProps)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export interface IFilterConfiguration extends IFilterConfigurationData {

isFilterControlsDisplayed: boolean;
activeFilters: IFilter[];
activeCompleteFilters: IFilter[];

filteringFunction(ignorePropertyId?: string): (row: any[], forceRowId?: string) => boolean;

Expand Down

0 comments on commit 9531951

Please sign in to comment.