Merge pull request #6546 from opf/fix/28309/avoid-reloading-on-removing

[28309] Avoid reloading table on removing columns

[ci skip]
pull/6549/head
Oliver Günther 6 years ago committed by GitHub
commit e29dfc7490
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      frontend/src/app/components/wp-fast-table/state/wp-table-columns.service.ts

@ -61,10 +61,17 @@ export class WorkPackageTableColumnsService extends WorkPackageTableBaseService<
}
public applyToQuery(query:QueryResource) {
query.columns = cloneHalResourceCollection<QueryColumn>(this.getColumns());
const toApply = this.getColumns();
const oldColumns = query.columns.map(el => el.id);
const newColumns = toApply.map(el => el.id);
query.columns = cloneHalResourceCollection<QueryColumn>(toApply);
// We can avoid reloading even with relation columns if we only removed columns
const onlyRemoved = _.difference(newColumns, oldColumns).length === 0;
// Reload the table visibly if adding relation columns.
return this.hasRelationColumns();
return !onlyRemoved && this.hasRelationColumns();
}
/**

Loading…
Cancel
Save