Bug report #18699

[Layout] Data-defined attribute table source layer does not update structure when initial layer changes

Added by Harrissou Santanna almost 6 years ago.

Status:Open
Priority:Normal
Assignee:-
Category:Map Composer/Printing
Affected QGIS version:3.1(master) Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:26587

Description

In a project let's add 3 layers: 'layerA', 'layerB', 'layerC'
In a Print layout, enable atlas generation on 'layerA'
Add an attribute table, select layer features, and use 'layerB' as source

1/ If you switch layers in the attribute table Layer combobox, the attribute table item is updated accordingly. Great.

2/ Now in the data-defined option beside Layer combobox, use expression like case when @atlas_featureid %2 then 'layerB' else 'layerC' end
Preview the atlas and you'll notice that attribute table changes according to atlas feature ID. also Great.

3/ Now instead of using 'layerB' as attribute table source, select 'layerC' in the Layer combobox (while the DD button is still active). The table structure is not refreshed, even if you click on "refresh table data" or "attributes" (this one still shows layerB structure).
I'd expect attribute table columns being the ones of the layer currently shown in the combobox.

The only way I can change the underlying table structure is to redraw a new table.

Also available in: Atom PDF