From 6096f106b3ad2332f34aaf1ab6b23e01d45c1844 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 9 Sep 2024 13:51:58 +0200 Subject: [PATCH] Handle resize all --- .../src/components/grid/stores/columns.js | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/frontend-core/src/components/grid/stores/columns.js b/packages/frontend-core/src/components/grid/stores/columns.js index b4eba300ad..4823f2159c 100644 --- a/packages/frontend-core/src/components/grid/stores/columns.js +++ b/packages/frontend-core/src/components/grid/stores/columns.js @@ -79,16 +79,24 @@ export const deriveStores = context => { } export const createActions = context => { - const { columns, datasource, schema } = context + const { columns, datasource } = context // Updates the width of all columns const changeAllColumnWidths = async width => { - const $schema = get(schema) - let mutations = {} - Object.keys($schema).forEach(field => { - mutations[field] = { width } + const $columns = get(columns) + $columns.forEach(column => { + const { related } = column + const mutation = { width } + if (!related) { + datasource.actions.addSchemaMutation(column.name, mutation) + } else { + datasource.actions.addSubSchemaMutation( + related.subField, + related.field, + mutation + ) + } }) - datasource.actions.addSchemaMutations(mutations) await datasource.actions.saveSchemaMutations() }