qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.52k stars 2.99k forks source link

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

Open qgib opened 6 years ago

qgib commented 6 years ago

Author Name: Harrissou Santanna (@DelazJ) Original Redmine Issue: 18699 Affected QGIS version: 3.1(master) Redmine category:map_composer/printing


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.

Pedro-Murteira commented 2 years ago

Still valid on QGIS 3.22.3.