@@ -950,14 +950,11 @@ protected RenderFragment RenderFooter()
950950
951951 for ( int i = 0 ; i < colPath . Count ; i ++ )
952952 {
953- if ( pivotColumns [ i ] . Property . Contains ( "it[" ) )
954- {
955- items = items . Where ( $ "it => { pivotColumns [ i ] . Property } == { ExpressionSerializer . FormatValue ( colPath [ i ] ) } ") ;
956- }
957- else
958- {
959- items = items . Where ( $ "i => i.{ pivotColumns [ i ] . Property } == { ExpressionSerializer . FormatValue ( colPath [ i ] ) } ") ;
960- }
953+ var property = pivotColumns [ i ] . Property ;
954+ var value = ExpressionSerializer . FormatValue ( colPath [ i ] ) ;
955+ items = property . Contains ( "it[" ) ?
956+ items . Where ( $ "it => { property } == { value } ") : items . Where ( $ "i => i.{ property } == { value } ") ;
957+
961958 }
962959
963960 var total = GetAggregateValue ( items , aggregate ) ;
@@ -1030,14 +1027,10 @@ private IQueryable<TItem> GetRowItems(PivotBodyRow pivotRow)
10301027 continue ; // Skip padding cells added to align depths
10311028 }
10321029
1033- if ( pivotRows [ i ] . Property . Contains ( "it[" ) )
1034- {
1035- items = items . Where ( $@ "it => { pivotRows [ i ] . Property } == { ExpressionSerializer . FormatValue ( cell . Value ) } ") ;
1036- }
1037- else
1038- {
1039- items = items . Where ( $@ "i => i.{ pivotRows [ i ] . Property } == { ExpressionSerializer . FormatValue ( cell . Value ) } ") ;
1040- }
1030+ var property = pivotRows [ i ] . Property ;
1031+ var value = ExpressionSerializer . FormatValue ( cell . Value ) ;
1032+ items = property . Contains ( "it[" ) ?
1033+ items . Where ( $@ "it => { property } == { value } ") : items . Where ( $@ "i => i.{ property } == { value } ") ;
10411034 }
10421035
10431036 return items ;
@@ -1263,14 +1256,10 @@ private void FlattenRowHeaderTree(RowHeaderNode node, List<RowHeaderCell> prefix
12631256 var items = node . Items ;
12641257 for ( int i = 0 ; i < colPath . Count ; i ++ )
12651258 {
1266- if ( pivotColumns [ i ] . Property . Contains ( "it[" ) )
1267- {
1268- items = items . Where ( $ "it => { pivotColumns [ i ] . Property } == { ExpressionSerializer . FormatValue ( colPath [ i ] ) } ") ;
1269- }
1270- else
1271- {
1272- items = items . Where ( $ "i => i.{ pivotColumns [ i ] . Property } == { ExpressionSerializer . FormatValue ( colPath [ i ] ) } ") ;
1273- }
1259+ var property = pivotColumns [ i ] . Property ;
1260+ var value = ExpressionSerializer . FormatValue ( colPath [ i ] ) ;
1261+ items = property . Contains ( "it[" ) ?
1262+ items . Where ( $ "it => { property } == { value } ") : items . Where ( $ "i => i.{ property } == { value } ") ;
12741263 }
12751264 row . ValueCells . Add ( items . Count ( ) > 0 ? GetAggregateValue ( items , aggregate ) : null ) ;
12761265 }
@@ -1310,26 +1299,18 @@ private void FlattenRowHeaderTree(RowHeaderNode node, List<RowHeaderCell> prefix
13101299 // Filter by row path
13111300 for ( int i = 0 ; i < newPrefix . Count && i < pivotRows . Count ; i ++ )
13121301 {
1313- if ( pivotRows [ i ] . Property . Contains ( "it[" ) )
1314- {
1315- items = items . Where ( $@ "it => { pivotRows [ i ] . Property } == { ExpressionSerializer . FormatValue ( newPrefix [ i ] . Value ) } ") ;
1316- }
1317- else
1318- {
1319- items = items . Where ( $@ "i => i.{ pivotRows [ i ] . Property } == { ExpressionSerializer . FormatValue ( newPrefix [ i ] . Value ) } ") ;
1320- }
1302+ var property = pivotRows [ i ] . Property ;
1303+ var value = ExpressionSerializer . FormatValue ( newPrefix [ i ] . Value ) ;
1304+ items = property . Contains ( "it[" ) ?
1305+ items . Where ( $@ "it => { property } == { value } ") : items . Where ( $@ "i => i.{ property } == { value } ") ;
13211306 }
13221307 // Filter by column path
13231308 for ( int i = 0 ; i < colPath . Count ; i ++ )
13241309 {
1325- if ( pivotColumns [ i ] . Property . Contains ( "it[" ) )
1326- {
1327- items = items . Where ( $ "it => { pivotColumns [ i ] . Property } == { ExpressionSerializer . FormatValue ( colPath [ i ] ) } ") ;
1328- }
1329- else
1330- {
1331- items = items . Where ( $ "i => i.{ pivotColumns [ i ] . Property } == { ExpressionSerializer . FormatValue ( colPath [ i ] ) } ") ;
1332- }
1310+ var property = pivotColumns [ i ] . Property ;
1311+ var value = ExpressionSerializer . FormatValue ( colPath [ i ] ) ;
1312+ items = property . Contains ( "it[" ) ?
1313+ items . Where ( $ "it => { property } == { value } ") : items . Where ( $ "i => i.{ property } == { value } ") ;
13331314 }
13341315 collapsedRow . ValueCells . Add ( items . Count ( ) > 0 ? GetAggregateValue ( items , aggregate ) : null ) ;
13351316 }
0 commit comments