Skip to content

Commit 706bf89

Browse files
xristianstefanovdimodi
authored andcommitted
chore(Grid): update onread examples due to a latest changes (#2558)
* chore(Grid): update onread examples due to a latest changes * chore(Grid): update breaking change article * Update upgrade/breaking-changes/7-0-0.md Co-authored-by: Dimo Dimov <[email protected]> --------- Co-authored-by: Dimo Dimov <[email protected]>
1 parent 24609fc commit 706bf89

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

components/grid/grouping/load-on-demand.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@ Scroll through the groups or expand them to load their data on demand
161161
162162
if (args.Request.Groups.Count > 0)
163163
{
164-
args.Data = result.GroupedData.Cast<object>().ToList();
164+
args.Data = result.GroupedData;
165165
}
166166
else
167167
{
168-
args.Data = result.CurrentPageData.Cast<object>().ToList();
168+
args.Data = result.CurrentPageData;
169169
}
170170
171171
args.Total = result.TotalItemCount;

components/grid/manual-operations.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ This sample shows how to set up the grid to use grouping with manual data source
232232
@code {
233233
public List<Employee> SourceData { get; set; }
234234
235-
// Handling grouping happens here - by casting the DataSourceResult.Data to objects
236235
protected async Task ReadItems(GridReadEventArgs args)
237236
{
238237
// in this example, we use the Telerik extension methods to shape the data
@@ -243,7 +242,7 @@ This sample shows how to set up the grid to use grouping with manual data source
243242
// to work with grouping, the grid data needs to be an IEnumerable<object>
244243
// because grouped data has a different shape than non-grouped data
245244
// and this is, generally, hidden from you by the grid, but now it cannot be
246-
args.Data = datasourceResult.Data.Cast<object>().ToList();
245+
args.Data = datasourceResult.Data;
247246
248247
args.Total = datasourceResult.Total;
249248
args.AggregateResults = datasourceResult.AggregateResults;

knowledge-base/grid-custom-grouping-order.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ To achieve custom grouping order in the Telerik Grid for Blazor, follow these st
9595
List<string> customOrder = new List<string> { "Text D", "Text A", "Text C", "Text B" };
9696
groups = groups.OrderBy(group => customOrder.IndexOf(group.Key.ToString())).ToList();
9797
98-
args.Data = groups.Cast<object>().ToList();
98+
args.Data = groups;
9999
}
100100
else
101101
{
@@ -104,7 +104,7 @@ To achieve custom grouping order in the Telerik Grid for Blazor, follow these st
104104
.OrderBy(Text => GetCustomOrderIndex(Text.S1))
105105
.ToList();
106106
107-
args.Data = orderedData.Cast<object>().ToList();
107+
args.Data = orderedData;
108108
}
109109
110110
args.Total = datasourceResult.Total;

upgrade/breaking-changes/7-0-0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ The obsolete `ClearButton` parameter is removed. Use `ShowClearButton` instead.
4343
* The obsolete `AutoFitColumn()` method is removed. [Use `AutoFitColumnAsync()`]({%slug components/grid/columns/resize%}#autofit-columns) instead.
4444
* The obsolete `AutoFitColumns()` method is removed. Use `AutoFitColumnsAsync()` instead.
4545
* The obsolete `AutoFitAllColumns()` method is removed. Use `AutoFitAllColumnsAsync()` instead.
46+
* When using [grouping and `OnRead`]({%slug components/grid/manual-operations%}#grouping-with-onread), casting `DataSourceResult.Data` to a list of objects (`.Cast<object>()`) is no longer needed.
4647

4748
## TextArea
4849

0 commit comments

Comments
 (0)