Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(grid): Update Grid KB with virtual scrolling information #2012

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions knowledge-base/grid-get-filtered-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Things to consider:

1. Obtain the [Grid state]({%slug grid-state%}) in the [Grid `OnStateChanged` event]({%slug grid-state%}#events) or with the [Grid `GetState()` method]({%slug grid-state%}#methods). The exact approach depends on if you want to get the current visible Grid data automatically or on demand.
1. Create a new [`DataSourceRequest` object](/blazor-ui/api/Telerik.DataSource.DataSourceRequest). Populate its properties with [the respective information from the `GridState` object]({%slug grid-state%}#information-in-the-grid-state). Note that the `Filters` property of the `DataSourceRequest` will have to include filter descriptors from two [`GridState` properties](/blazor-ui/api/Telerik.Blazor.Components.GridState-1) - `FilterDescriptors` and `SearchFilter`.
1. (optional) If you want to get the currently filtered and sorted data from all Grid pages, do not set the `Page` and `PageSize` properties of the `DataSourceRequest` object.
1. (optional) If you want to get the currently filtered and sorted data from all Grid pages, do not set the `Page`, `PageSize`, and `Skip` properties of the `DataSourceRequest` object.
1. Execute the [`ToDataSourceResult()` extension method]({%slug common-features-data-binding-onread%}#todatasourceresult-method) on the Grid `Data` collection. You will need to import the `Telerik.DataSource.Extensions` namespace.
1. The currently visible Grid data will be in the `Data` property of the `DataSourceResult` object, which is returned by `ToDataSourceResult()`. The total Grid item count (on all pages) will be in the `Total` property.

Expand Down Expand Up @@ -141,8 +141,9 @@ or
{
Filters = filterAndSearchDescriptors,
Groups = gridState.GroupDescriptors.ToList(),
Page = gridState.Page ?? 1,
Page = gridState.Page ?? 1, // for paging
PageSize = GridPageSize,
Skip = gridState.Skip ?? 0, // for virtual scrolling
Sorts = gridState.SortDescriptors.ToList()
};

Expand Down Expand Up @@ -207,7 +208,7 @@ or
Optionally, if you want to get the currently filtered and sorted data from all Grid pages:

1. Execute `ToDataSourceResult()` over the Grid datasource as usual. This will produce the data items on the current Grid page.
1. Reset the `Page` and `PageSize` properties of the `DataSourceRequest` object in the `GridReadEventArgs` event argument.
1. Reset the `Page`, `PageSize`, and `Skip` properties of the `DataSourceRequest` object in the `GridReadEventArgs` event argument.
1. Repeat the `ToDataSourceResult()` call over the Grid datasource. This will produce the data items from all Grid pages.

The most important part of the example below is in the `OnGridRead` handler.
Expand Down
Loading