Skip to content

Commit

Permalink
[layouts] Fix attribute table sort order combined with feature filter
Browse files Browse the repository at this point in the history
results in empty tables

Fixes #36341
  • Loading branch information
nyalldawson committed Jun 12, 2020
1 parent 03e81e8 commit 24897ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/layout/qgslayoutitemattributetable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ bool QgsLayoutItemAttributeTable::getTableContents( QgsLayoutTableContents &cont
context.setFields( layer->fields() );

QgsFeatureRequest req;
req.setExpressionContext( context );

//prepare filter expression
std::unique_ptr<QgsExpression> filterExpression;
Expand All @@ -409,7 +410,6 @@ bool QgsLayoutItemAttributeTable::getTableContents( QgsLayoutTableContents &cont
{
activeFilter = true;
req.setFilterExpression( mFeatureFilter );
req.setExpressionContext( context );
}
}

Expand Down Expand Up @@ -478,7 +478,7 @@ bool QgsLayoutItemAttributeTable::getTableContents( QgsLayoutTableContents &cont

for ( const QgsLayoutTableColumn &column : qgis::as_const( mSortColumns ) )
{
req = req.addOrderBy( column.attribute(), column.sortOrder() == Qt::AscendingOrder );
req.addOrderBy( column.attribute(), column.sortOrder() == Qt::AscendingOrder );
}

QgsFeature f;
Expand Down

0 comments on commit 24897ab

Please sign in to comment.