Skip to content
Permalink
Browse files

[layouts] Fix attribute table sort order combined with feature filter

results in empty tables

Fixes #36341
  • Loading branch information
nyalldawson committed Jun 12, 2020
1 parent 03e81e8 commit 24897ab86a7f11be196d8d705fa3307b05e0e53d
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core/layout/qgslayoutitemattributetable.cpp
@@ -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;
@@ -409,7 +410,6 @@ bool QgsLayoutItemAttributeTable::getTableContents( QgsLayoutTableContents &cont
{
activeFilter = true;
req.setFilterExpression( mFeatureFilter );
req.setExpressionContext( context );
}
}

@@ -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;

0 comments on commit 24897ab

Please sign in to comment.
You can’t perform that action at this time.