Skip to content

Commit d2885ce

Browse files
committed
1006379: Update Grouping and Paging combinations
1 parent 5fdc5db commit d2885ce

File tree

1 file changed

+11
-27
lines changed
  • Binding SQLite using CustomAdaptor/Blazor Web App/Grid_SQLite/Components/Pages

1 file changed

+11
-27
lines changed

Binding SQLite using CustomAdaptor/Blazor Web App/Grid_SQLite/Components/Pages/Home.razor

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109

110110
public override async Task<object> ReadAsync(DataManagerRequest dataManagerRequest, string? key = null)
111111
{
112-
IEnumerable<Asset> dataSource = await _assetService!.GetAssetsAsync();
112+
IEnumerable dataSource = await _assetService!.GetAssetsAsync();
113113

114114
// Handling Search
115115
if (dataManagerRequest.Search != null && dataManagerRequest.Search.Count > 0)
@@ -129,34 +129,8 @@
129129
dataSource = DataOperations.PerformSorting(dataSource, dataManagerRequest.Sorted);
130130
}
131131

132-
// Handling Aggregation
133-
IDictionary<string, object>? aggregates = null;
134-
if (dataManagerRequest.Aggregates != null)
135-
{
136-
aggregates = DataUtil.PerformAggregation(dataSource, dataManagerRequest.Aggregates);
137-
//Add custom logic here if needed and remove above method
138-
}
139-
140-
141132
int totalRecordsCount = dataSource.Cast<Asset>().Count();
142133

143-
// Handling Grouping
144-
DataResult dataObject = new DataResult();
145-
146-
if (dataManagerRequest.Group != null)
147-
{
148-
IEnumerable ResultData = dataSource.ToList();
149-
foreach (var group in dataManagerRequest.Group)
150-
{
151-
ResultData = DataUtil.Group<Asset>(ResultData, group, dataManagerRequest.Aggregates, 0, dataManagerRequest.GroupByFormatter);
152-
//Add custom logic here if needed and remove above method
153-
}
154-
dataObject.Result = ResultData;
155-
dataObject.Count = totalRecordsCount;
156-
dataObject.Aggregates = aggregates;
157-
return dataManagerRequest.RequiresCounts ? dataObject : (object)ResultData;
158-
}
159-
160134
// Handling Paging
161135
if (dataManagerRequest.Skip != 0)
162136
{
@@ -170,6 +144,16 @@
170144
//Add custom logic here if needed and remove above method
171145
}
172146

147+
//Handling Groping
148+
if (dataManagerRequest.Group != null)
149+
{
150+
foreach (var group in dataManagerRequest.Group)
151+
{
152+
dataSource = DataUtil.Group<Asset>(dataSource, group, dataManagerRequest.Aggregates, 0, dataManagerRequest.GroupByFormatter);
153+
//Add custom logic here if needed and remove above method
154+
}
155+
}
156+
173157
return dataManagerRequest.RequiresCounts
174158
? new DataResult() { Result = dataSource, Count = totalRecordsCount }
175159
: (object)dataSource;

0 commit comments

Comments
 (0)