From 777c5dc63152b9ed18e5c2fa1a5d5234626ba93e Mon Sep 17 00:00:00 2001
From: Dimo Dimov
Date: Tue, 18 Jan 2022 14:28:35 +0200
Subject: [PATCH 1/4] docs: Document OnRead breaking changes
---
.../common/dropdowns-virtualization.md | 11 +-
common-features/loading-sign.md | 20 +-
components/autocomplete/events.md | 99 +++---
components/autocomplete/virtualization.md | 41 +--
components/combobox/events.md | 98 +++---
components/combobox/virtualization.md | 25 +-
components/dropdownlist/events.md | 97 +++---
components/dropdownlist/virtualization.md | 26 +-
components/grid/filter/checkboxlist.md | 23 +-
components/grid/grouping/load-on-demand.md | 14 +-
components/grid/manual-operations.md | 321 +++++-------------
components/grid/refresh-data.md | 23 +-
components/grid/templates/column-footer.md | 127 +------
components/grid/virtual-scrolling.md | 13 +-
components/listview/manual-operations.md | 27 +-
components/multiselect/events.md | 91 ++---
components/multiselect/virtualization.md | 21 +-
components/scheduler/manual-operations.md | 2 +-
components/scheduler/templates/dateheader.md | 2 +-
knowledge-base/combo-debounce-onread.md | 36 +-
.../grid-aggregates-and-datatable.md | 95 ++----
.../grid-combobox-in-filtermenu-empty.md | 7 +-
knowledge-base/grid-debounce-operations.md | 28 +-
knowledge-base/grid-expand-button-tooltip.md | 27 +-
knowledge-base/grid-expand-only-current.md | 63 +---
knowledge-base/grid-force-refresh.md | 101 +-----
knowledge-base/grid-get-filtered-data.md | 55 +--
knowledge-base/grid-get-index-of-grid-row.md | 143 ++------
.../grid-large-skip-breaks-virtualization.md | 39 +--
.../grid-one-expanded-detail-template.md | 37 +-
knowledge-base/grid-row-numbers.md | 30 +-
.../grid-search-in-hidden-fields.md | 30 +-
upgrade/breaking-changes/3-0-0.md | 107 +++++-
33 files changed, 693 insertions(+), 1186 deletions(-)
diff --git a/_contentTemplates/common/dropdowns-virtualization.md b/_contentTemplates/common/dropdowns-virtualization.md
index 0b6e20c8c4..fabbb1dfe3 100644
--- a/_contentTemplates/common/dropdowns-virtualization.md
+++ b/_contentTemplates/common/dropdowns-virtualization.md
@@ -13,11 +13,11 @@ This section will explain the parameters and behaviors that are related to the v
* `ScrollMode` - `Telerik.Blazor.DropDownScrollMode` - set it to `DropDownScrollMode.Virtual`. It defaults to the "regular" scrolling.
-* `PopupHeight` - `string` - set the height of the popup element to a valid CSS unit. It must **not** be a `null/empty` string.
+* `Height` - `string` - [set the height]({%slug common-features/dimensions%}) in the nested **popup settings** tag of the component. It must **not** be a `null/empty` string.
* `ItemHeight` - `decimal` - set it to the height each individual item will have in the dropdown. Make sure to accommodate the content your items will have and any item template.
-* `PageSize` - `int` - defines how many items will actually be rendered and reused. The value determines how many items are loaded on each scroll. The number of items must be large enough according to the `ItemHeight` and `PopupHeight` so that there are more items than the dropdown so there is a scrollbar.
+* `PageSize` - `int` - defines how many items will actually be rendered and reused. The value determines how many items are loaded on each scroll. The number of items must be large enough according to the `ItemHeight` and popup `Height`, so that there are more items than the dropdown so there is a scrollbar.
You can find a basic example in the [Local Data](#local-data-example) section below.
@@ -27,16 +27,13 @@ You can find a basic example in the [Local Data](#local-data-example) section be
#value-mapper-text
-the component will call this method to request the model that matches the `Value` it has set. This is required because with remote data the `Value` may not be in the initial collection of `Data` that the component has, and so there would otherwise be no way to extract the `DataTextField` from it to render it. Usually, this method will be called on the initial render only to fetch the data item for the current selection.
+the component will call this method to request the model that matches the `Value` it has set. This is required because with remote data the `Value` may not be in the initial collection of data that the component has, and so there would otherwise be no way to extract the `DataTextField` from it to render it. Usually, this method will be called on the initial render only to fetch the data item for the current selection.
#end
#remote-data-specifics
-* `OnRead` - `EventCallback` - the component will call this event when the user scrolls with the corresponding offset (`Skip`), `PageSize` and any filters. This lets you optimize the data queries and return only what is needed at the moment, when it is needed.
-
-* `TotalCount` - `int` - the total number of items that the dropdown can have. Needs to take into account any current filtering.
-#end
+* `OnRead` - `EventCallback` - the component will call this event when the user scrolls with the corresponding offset (`Skip`), `PageSize` and any filters. This lets you optimize the data queries and return only what is needed at the moment, when it is needed. Set the `args.Data` and `args.Total` properties of the event argument object.
diff --git a/common-features/loading-sign.md b/common-features/loading-sign.md
index 809294a582..061ca60554 100644
--- a/common-features/loading-sign.md
+++ b/common-features/loading-sign.md
@@ -358,16 +358,15 @@ We understand, however, that you might want to disable this feature in some case
@* The data operations (such as filtering, sorting, paging) are slow in this example, but there is no loading sign *@
+ TItem="@Employee" OnRead="@ReadItems"
+ FilterMode="@GridFilterMode.FilterRow"
+ Sortable="true"
+ Pageable="true">
-
- Add Employee
-
@* Everything else here is sample data binding *@
@@ -376,8 +375,6 @@ We understand, however, that you might want to disable this feature in some case
@code {
public List SourceData { get; set; }
- public List GridData { get; set; }
- public int Total { get; set; } = 0;
protected override void OnInitialized()
{
@@ -390,15 +387,10 @@ We understand, however, that you might want to disable this feature in some case
var datasourceResult = SourceData.ToDataSourceResult(args.Request);
- GridData = (datasourceResult.Data as IEnumerable).ToList();
- Total = datasourceResult.Total;
-
- StateHasChanged();
+ args.Data = (datasourceResult.Data as IEnumerable).ToList();
+ args.Total = datasourceResult.Total;
}
- //This sample implements only reading of the data. To add the rest of the CRUD operations see
- //https://docs.telerik.com/blazor-ui/components/grid/editing/overview
-
private List GenerateData()
{
var result = new List();
diff --git a/components/autocomplete/events.md b/components/autocomplete/events.md
index a2200cb066..548ab6f6c9 100644
--- a/components/autocomplete/events.md
+++ b/components/autocomplete/events.md
@@ -77,7 +77,6 @@ from model: @Role
}
````
-
## OnChange
The `OnChange` event represents a user action - confirmation of the current value/item. The key differences with `ValueChanged` are:
@@ -121,32 +120,34 @@ You can use the he `OnRead` event to provide data to the component according to
You can also call remote data through async operations.
+When using `OnRead`, make sure to set `TItem` and `TValue`.
+
>caption Custom Data according to the user input in the AutoComplete
````CSHTML
-@SelectedValue
-
-@AutoCompleteValue
+
+
+ Placeholder="Type anything">
-@code{
- public string SelectedValue { get; set; }
+@code {
+ public string AutoCompleteValue { get; set; }
List Suggestions { get; set; } = new List();
async Task ReadItems(AutoCompleteReadEventArgs args)
{
- if (args.Request.Filters.Count > 0) // there is user filter input, skips providing data on initialization
+ if (args.Request.Filters.Count > 0) // wait for user filter input
{
Telerik.DataSource.FilterDescriptor filter = args.Request.Filters[0] as Telerik.DataSource.FilterDescriptor;
string userInput = filter.Value.ToString();
string method = filter.Operator.ToString();
//new data collection comes down from the service
- Suggestions = await GetSuggestionsData(userInput, method);
+ args.Data = await GetSuggestionsData(userInput, method);
}
}
@@ -157,7 +158,7 @@ You can also call remote data through async operations.
//sample logic for getting suggestions - here they are generated, you can call a remote service
//for brevity, this example does not use the filter operator, but your actual service can
List suggestionsData = new List();
- for (int i = 0; i < 5; i++)
+ for (int i = 1; i <= 5; i++)
{
suggestionsData.Add($"suggestion {i} for input {userInput}");
}
@@ -172,53 +173,51 @@ You can also call remote data through async operations.
````CSHTML
@using Telerik.DataSource.Extensions
-@SelectedValue
-
-
+
@AutoCompleteValue
+
+
@code {
- public string SelectedValue { get; set; }
+ public string AutoCompleteValue { get; set; }
List AllSuggestions { get; set; }
- List CurrentSuggestions { get; set; }
-
protected async Task ReadItems(AutoCompleteReadEventArgs args)
{
- //generate the big data source that we want to narrow down for the user
- //in a real case you would probably have fetched it in OnInitializedAsync
- if (AllSuggestions == null)
- {
- AllSuggestions = new List
- {
- new Car { Id = 1, Make = "Honda" },
- new Car { Id = 2, Make = "Opel" },
- new Car { Id = 3, Make = "Audi" },
- new Car { Id = 4, Make = "Lancia" },
- new Car { Id = 5, Make = "BMW" },
- new Car { Id = 6, Make = "Mercedes" },
- new Car { Id = 7, Make = "Tesla" },
- new Car { Id = 8, Make = "Vw" },
- new Car { Id = 9, Make = "Alpha Romeo" },
- new Car { Id = 10, Make = "Chevrolet" },
- new Car { Id = 11, Make = "Ford" },
- new Car { Id = 12, Make = "Cadillac" },
- new Car { Id = 13, Make = "Dodge" },
- new Car { Id = 14, Make = "Jeep" },
- new Car { Id = 15, Make = "Chrysler" },
- new Car { Id = 16, Make = "Lincoln" }
- };
- }
-
- //use Telerik extension methods to filter the data source based on the request from the component
+ //using Telerik extension methods to filter the data
var datasourceResult = AllSuggestions.ToDataSourceResult(args.Request);
- CurrentSuggestions = (datasourceResult.Data as IEnumerable).ToList();
+ args.Data = datasourceResult.Data;
+ }
+
+ protected override void OnInitialized()
+ {
+ AllSuggestions = new List {
+ new Car { Id = 1, Make = "Honda" },
+ new Car { Id = 2, Make = "Opel" },
+ new Car { Id = 3, Make = "Audi" },
+ new Car { Id = 4, Make = "Lancia" },
+ new Car { Id = 5, Make = "BMW" },
+ new Car { Id = 6, Make = "Mercedes" },
+ new Car { Id = 7, Make = "Tesla" },
+ new Car { Id = 8, Make = "Vw" },
+ new Car { Id = 9, Make = "Alpha Romeo" },
+ new Car { Id = 10, Make = "Chevrolet" },
+ new Car { Id = 11, Make = "Ford" },
+ new Car { Id = 12, Make = "Cadillac" },
+ new Car { Id = 13, Make = "Dodge" },
+ new Car { Id = 14, Make = "Jeep" },
+ new Car { Id = 15, Make = "Chrysler" },
+ new Car { Id = 16, Make = "Lincoln" }
+ };
+
+ base.OnInitialized();
}
-
+
public class Car
{
public int Id { get; set; }
@@ -227,8 +226,6 @@ You can also call remote data through async operations.
}
````
-
-
## OnBlur
The `OnBlur` event fires when the component loses focus.
diff --git a/components/autocomplete/virtualization.md b/components/autocomplete/virtualization.md
index 8043c3763e..90d62fe3e2 100644
--- a/components/autocomplete/virtualization.md
+++ b/components/autocomplete/virtualization.md
@@ -24,7 +24,6 @@ The AutoComplete @[template](/_contentTemplates/common/dropdowns-virtualization.

-
## Basics
@[template](/_contentTemplates/common/dropdowns-virtualization.md#basics-core)
@@ -37,7 +36,6 @@ The AutoComplete @[template](/_contentTemplates/common/dropdowns-virtualization.
@[template](/_contentTemplates/common/dropdowns-virtualization.md#limitations)
-
## Local Data Example
@@ -73,8 +71,6 @@ The AutoComplete @[template](/_contentTemplates/common/dropdowns-virtualization.
}
````
-
-
## Remote Data Example
@[template](/_contentTemplates/common/dropdowns-virtualization.md#remote-data-sample-intro)
@@ -85,31 +81,30 @@ Run this and see how you can display, scroll and filter over 10k records in the
@using Telerik.DataSource
@using Telerik.DataSource.Extensions
-@SelectedValue
-
-@AutoCompleteValue
+
+
+ OnRead="@GetRemoteData"
+ @bind-Value="@AutoCompleteValue"
+ Filterable="true"
+ FilterOperator="@StringFilterOperator.Contains">
+
+
+
-@code{
- string SelectedValue { get; set; } = "Name 1234"; // pre-select an item to showcase it works like in a regular textbox
- List CurentPageOfData { get; set; }
- int TotalItems { get; set; }
+@code {
+ string AutoCompleteValue { get; set; } = "Name 1234"; // pre-select an item to showcase it works like in a regular textbox
- async Task GetRemoteData(AutoCompleteReadEventArgs e)
+ async Task GetRemoteData(AutoCompleteReadEventArgs args)
{
- DataEnvelope result = await MyService.GetItems(e.Request);
+ DataEnvelope result = await MyService.GetItems(args.Request);
- CurentPageOfData = result.Data;
- TotalItems = result.Total;
+ args.Data = result.Data;
+ args.Total = result.Total;
}
// mimics a real service in terms of API appearance, refactor as necessary for your app
@@ -149,6 +144,4 @@ Run this and see how you can display, scroll and filter over 10k records in the
## See Also
- * [Live Demo: AutoComplete Virtualization](https://demos.telerik.com/blazor-ui/autocomplete/virtualization)
-
-
+* [Live Demo: AutoComplete Virtualization](https://demos.telerik.com/blazor-ui/autocomplete/virtualization)
diff --git a/components/combobox/events.md b/components/combobox/events.md
index ebfbbdc328..7ba295ac11 100644
--- a/components/combobox/events.md
+++ b/components/combobox/events.md
@@ -212,43 +212,44 @@ You can use the `OnRead` event to provide data to the component according to som
You can also call remote data through `async` operations.
+When using `OnRead`, make sure to set `TItem` and `TValue`.
+
>caption Custom Data according to the user input in the ComboBox
>tip You can also [debounce the service calls and implement minimum filter length]({%slug combo-kb-debounce-onread%}).
->important You should **change** **only** the `Data` of the ComboBox in the `OnRead` handler. You should **not** change other parameters such as `Value`, because this can lead to issues with the asynchronous nature of the event - the ComboBox cannot know whether the change of those parameters comes from somewhere external, and race conditions can occur with the arrival of the new data. Moreover, such a change is likely to be unwanted and unexpected for the end user and cause bad UX.
+>important You should **change** **only** the data of the ComboBox in the `OnRead` handler. You should **not** change other parameters such as `Value`, because this can lead to issues with the asynchronous nature of the event - the ComboBox cannot know whether the change of those parameters comes from somewhere external, and race conditions can occur with the arrival of the new data. Moreover, such a change is likely to be unwanted and unexpected for the end user and cause bad UX.
````CSHTML
-@SelectedValue
-
-@SelectedValue
+
+
+ Placeholder="Type anything">
-@code{
+@code {
public string SelectedValue { get; set; }
- List Options { get; set; } = new List();
async Task ReadItems(ComboBoxReadEventArgs args)
{
- if (args.Request.Filters.Count > 0) // there is user filter input, skips providing data on initialization
+ if (args.Request.Filters.Count > 0) // wait for user input to load data
{
Telerik.DataSource.FilterDescriptor filter = args.Request.Filters[0] as Telerik.DataSource.FilterDescriptor;
string userInput = filter.Value.ToString();
string method = filter.Operator.ToString();
//new data collection comes down from the service
- Options = await GetOptions(userInput, method);
+ args.Data = await GetOptions(userInput, method);
}
else
{
// when there is no user input you may still want to provide data
// in this example we just hardcode a few items, you can either fetch all the data
// or you can provide some subset of most common items, or something based on the business logic
- Options = new List() { "one", "two", "three" };
+ args.Data = new List() { "one", "two", "three" };
}
}
@@ -256,10 +257,10 @@ You can also call remote data through `async` operations.
{
await Task.Delay(500); // simulate network delay, remove it for a real app
- //sample logic for getting suggestions - here they are generated, you can call a remote service
+ //dummy suggestions
//for brevity, this example does not use the filter operator, but your actual service can
List optionsData = new List();
- for (int i = 0; i < 5; i++)
+ for (int i = 1; i <= 5; i++)
{
optionsData.Add($"option {i} for input {userInput}");
}
@@ -277,51 +278,50 @@ You can also call remote data through `async` operations.
````CSHTML
@using Telerik.DataSource.Extensions
-@SelectedValue
-
-
+
Selected Id: @SelectedValue
+
+
@code {
public int? SelectedValue { get; set; }
List AllOptions { get; set; }
- List CurrentOptions { get; set; }
-
protected async Task ReadItems(ComboBoxReadEventArgs args)
{
- //generate the big data source that we want to narrow down for the user
- //in a real case you would probably have fetched it in OnInitializedAsync
- if (AllOptions == null)
- {
- AllOptions = new List
- {
- new Car { Id = 1, Make = "Honda" },
- new Car { Id = 2, Make = "Opel" },
- new Car { Id = 3, Make = "Audi" },
- new Car { Id = 4, Make = "Lancia" },
- new Car { Id = 5, Make = "BMW" },
- new Car { Id = 6, Make = "Mercedes" },
- new Car { Id = 7, Make = "Tesla" },
- new Car { Id = 8, Make = "Vw" },
- new Car { Id = 9, Make = "Alpha Romeo" },
- new Car { Id = 10, Make = "Chevrolet" },
- new Car { Id = 11, Make = "Ford" },
- new Car { Id = 12, Make = "Cadillac" },
- new Car { Id = 13, Make = "Dodge" },
- new Car { Id = 14, Make = "Jeep" },
- new Car { Id = 15, Make = "Chrysler" },
- new Car { Id = 16, Make = "Lincoln" }
- };
- }
-
- //use Telerik extension methods to filter the data source based on the request from the component
+ //using Telerik extension methods to filter the data
var datasourceResult = AllOptions.ToDataSourceResult(args.Request);
- CurrentOptions = (datasourceResult.Data as IEnumerable).ToList();
+ args.Data = (datasourceResult.Data as IEnumerable).ToList();
+ }
+
+ protected override void OnInitialized()
+ {
+ AllOptions = new List {
+ new Car { Id = 1, Make = "Honda" },
+ new Car { Id = 2, Make = "Opel" },
+ new Car { Id = 3, Make = "Audi" },
+ new Car { Id = 4, Make = "Lancia" },
+ new Car { Id = 5, Make = "BMW" },
+ new Car { Id = 6, Make = "Mercedes" },
+ new Car { Id = 7, Make = "Tesla" },
+ new Car { Id = 8, Make = "Vw" },
+ new Car { Id = 9, Make = "Alpha Romeo" },
+ new Car { Id = 10, Make = "Chevrolet" },
+ new Car { Id = 11, Make = "Ford" },
+ new Car { Id = 12, Make = "Cadillac" },
+ new Car { Id = 13, Make = "Dodge" },
+ new Car { Id = 14, Make = "Jeep" },
+ new Car { Id = 15, Make = "Chrysler" },
+ new Car { Id = 16, Make = "Lincoln" }
+ };
+
+ base.OnInitialized();
}
public class Car
diff --git a/components/combobox/virtualization.md b/components/combobox/virtualization.md
index 7a5e529b8f..20fcf258c8 100644
--- a/components/combobox/virtualization.md
+++ b/components/combobox/virtualization.md
@@ -37,8 +37,6 @@ The ComboBox @[template](/_contentTemplates/common/dropdowns-virtualization.md#v
## Local Data Example
-
-
````CSHTML
@SelectedValue
@@ -86,35 +84,33 @@ Run this and see how you can display, scroll and filter over 10k records in the
@using Telerik.DataSource
@using Telerik.DataSource.Extensions
-@SelectedValue
-
-@SelectedValue
+
+
+
+
+
@code{
int SelectedValue { get; set; } = 1234; // pre-select an item to showcase the value mapper
- List CurentPageOfData { get; set; }
- int TotalItems { get; set; }
- async Task GetRemoteData(ComboBoxReadEventArgs e)
+ async Task GetRemoteData(ComboBoxReadEventArgs args)
{
- DataEnvelope result = await MyService.GetItems(e.Request);
+ DataEnvelope result = await MyService.GetItems(args.Request);
// set the Data and the TotalItems to the current page of data and total number of items
- CurentPageOfData = result.Data;
- TotalItems = result.Total;
+ args.Data = result.Data;
+ args.Total = result.Total;
}
async Task GetModelFromValue(int selectedValue)
@@ -123,7 +119,6 @@ Run this and see how you can display, scroll and filter over 10k records in the
return await MyService.GetItemFromValue(selectedValue);
}
-
// mimics a real service in terms of API appearance, refactor as necessary for your app
public static class MyService
{
diff --git a/components/dropdownlist/events.md b/components/dropdownlist/events.md
index 62bc0270bf..7f276a7aa6 100644
--- a/components/dropdownlist/events.md
+++ b/components/dropdownlist/events.md
@@ -127,16 +127,16 @@ You can also call remote data through `async` operations.
>tip You can also debounce the service calls and implement minimum filter length. An example of such approach is available in [this knowledge base article for the ComboBox]({%slug combo-kb-debounce-onread%}). The same approach is applicable for the DropDownList.
->important You should **change** **only** the `Data` of the DropDownList in the `OnRead` handler. You should **not** change other parameters such as `Value`, because this can lead to issues with the asynchronous nature of the event - the DropDownList cannot know whether the change of those parameters comes from somewhere external, and race conditions can occur with the arrival of the new data. Moreover, such a change is likely to be unwanted and unexpected for the end user and cause bad UX.
+>important You should **change** **only** the data of the DropDownList in the `OnRead` handler. You should **not** change other parameters such as `Value`, because this can lead to issues with the asynchronous nature of the event - the DropDownList cannot know whether the change of those parameters comes from somewhere external, and race conditions can occur with the arrival of the new data. Moreover, such a change is likely to be unwanted and unexpected for the end user and cause bad UX.
````CSHTML
-@SelectedValue
-
-
+
@SelectedValue
+
+
@code{
@@ -145,21 +145,21 @@ You can also call remote data through `async` operations.
async Task ReadItems(DropDownListReadEventArgs args)
{
- if (args.Request.Filters.Count > 0) // there is user filter input, skips providing data on initialization
+ if (args.Request.Filters.Count > 0) // wait for user input to load data
{
Telerik.DataSource.FilterDescriptor filter = args.Request.Filters[0] as Telerik.DataSource.FilterDescriptor;
string userInput = filter.Value.ToString();
string method = filter.Operator.ToString();
//new data collection comes down from the service
- Options = await GetOptions(userInput, method);
+ args.Data = await GetOptions(userInput, method);
}
else
{
// when there is no user input you may still want to provide data
// in this example we just hardcode a few items, you can either fetch all the data
// or you can provide some subset of most common items, or something based on the business logic
- Options = new List() { "one", "two", "three" };
+ args.Data = new List() { "one", "two", "three" };
}
}
@@ -167,10 +167,10 @@ You can also call remote data through `async` operations.
{
await Task.Delay(500); // simulate network delay, remove it for a real app
- //sample logic for getting suggestions - here they are generated, you can call a remote service
+ //dummy suggestions
//for brevity, this example does not use the filter operator, but your actual service can
List optionsData = new List();
- for (int i = 0; i < 5; i++)
+ for (int i = 1; i <= 5; i++)
{
optionsData.Add($"option {i} for input {userInput}");
}
@@ -188,51 +188,50 @@ You can also call remote data through `async` operations.
````CSHTML
@using Telerik.DataSource.Extensions
-@SelectedValue
-
-
+
Selected Id: @SelectedValue
+
+
@code {
public int? SelectedValue { get; set; }
List AllOptions { get; set; }
- List CurrentOptions { get; set; }
-
protected async Task ReadItems(DropDownListReadEventArgs args)
{
- //generate the big data source that we want to narrow down for the user
- //in a real case you would probably have fetched it in OnInitializedAsync
- if (AllOptions == null)
- {
- AllOptions = new List
- {
- new Car { Id = 1, Make = "Honda" },
- new Car { Id = 2, Make = "Opel" },
- new Car { Id = 3, Make = "Audi" },
- new Car { Id = 4, Make = "Lancia" },
- new Car { Id = 5, Make = "BMW" },
- new Car { Id = 6, Make = "Mercedes" },
- new Car { Id = 7, Make = "Tesla" },
- new Car { Id = 8, Make = "Vw" },
- new Car { Id = 9, Make = "Alpha Romeo" },
- new Car { Id = 10, Make = "Chevrolet" },
- new Car { Id = 11, Make = "Ford" },
- new Car { Id = 12, Make = "Cadillac" },
- new Car { Id = 13, Make = "Dodge" },
- new Car { Id = 14, Make = "Jeep" },
- new Car { Id = 15, Make = "Chrysler" },
- new Car { Id = 16, Make = "Lincoln" }
- };
- }
-
- //use Telerik extension methods to filter the data source based on the request from the component
+ //using Telerik extension methods to filter the data
var datasourceResult = AllOptions.ToDataSourceResult(args.Request);
- CurrentOptions = (datasourceResult.Data as IEnumerable).ToList();
+ args.Data = (datasourceResult.Data as IEnumerable).ToList();
+ }
+
+ protected override void OnInitialized()
+ {
+ AllOptions = new List {
+ new Car { Id = 1, Make = "Honda" },
+ new Car { Id = 2, Make = "Opel" },
+ new Car { Id = 3, Make = "Audi" },
+ new Car { Id = 4, Make = "Lancia" },
+ new Car { Id = 5, Make = "BMW" },
+ new Car { Id = 6, Make = "Mercedes" },
+ new Car { Id = 7, Make = "Tesla" },
+ new Car { Id = 8, Make = "Vw" },
+ new Car { Id = 9, Make = "Alpha Romeo" },
+ new Car { Id = 10, Make = "Chevrolet" },
+ new Car { Id = 11, Make = "Ford" },
+ new Car { Id = 12, Make = "Cadillac" },
+ new Car { Id = 13, Make = "Dodge" },
+ new Car { Id = 14, Make = "Jeep" },
+ new Car { Id = 15, Make = "Chrysler" },
+ new Car { Id = 16, Make = "Lincoln" }
+ };
+
+ base.OnInitialized();
}
public class Car
diff --git a/components/dropdownlist/virtualization.md b/components/dropdownlist/virtualization.md
index 5c905f9cce..3f4c396094 100644
--- a/components/dropdownlist/virtualization.md
+++ b/components/dropdownlist/virtualization.md
@@ -91,34 +91,33 @@ Run this and see how you can display, scroll and filter over 10k records in the
@using Telerik.DataSource
@using Telerik.DataSource.Extensions
-@SelectedValue
+
Selected Id: @SelectedValue
-
+ Filterable="true"
+ FilterOperator="@StringFilterOperator.Contains">
+
+
+
@code{
int SelectedValue { get; set; } = 1234; // pre-select an item to showcase the value mapper
- List CurentPageOfData { get; set; }
- int TotalItems { get; set; }
- async Task GetRemoteData(DropDownListReadEventArgs e)
+ async Task GetRemoteData(DropDownListReadEventArgs args)
{
- DataEnvelope result = await MyService.GetItems(e.Request);
+ DataEnvelope result = await MyService.GetItems(args.Request);
- CurentPageOfData = result.Data;
- TotalItems = result.Total;
+ args.Data = result.Data;
+ args.Total = result.Total;
}
async Task GetModelFromValue(int selectedValue)
@@ -127,7 +126,6 @@ Run this and see how you can display, scroll and filter over 10k records in the
return await MyService.GetItemFromValue(selectedValue);
}
-
// mimics a real service in terms of API appearance, refactor as necessary for your app
public static class MyService
{
diff --git a/components/grid/filter/checkboxlist.md b/components/grid/filter/checkboxlist.md
index 901e07a1e2..63045a31ec 100644
--- a/components/grid/filter/checkboxlist.md
+++ b/components/grid/filter/checkboxlist.md
@@ -94,9 +94,12 @@ Now try to filter by the On Vacation column - it will use only the current grid
depending on how you filter the data so you may never be able to get back all values.
-
+
@@ -122,9 +125,6 @@ depending on how you filter the data so you may never be able to get back all va
@code {
List AllGridData { get; set; }
- IEnumerable CurrentGridData { get; set; }
- int Total { get; set; }
-
#region custom-filter-data
List TeamsList { get; set; }
List NameOptions { get; set; }
@@ -171,12 +171,12 @@ depending on how you filter the data so you may never be able to get back all va
}
#endregion custom-filter-data
- async Task OnReadHandler(GridReadEventArgs e)
+ async Task OnReadHandler(GridReadEventArgs args)
{
//typical data retrieval for the grid
- var filteredData = await AllGridData.ToDataSourceResultAsync(e.Request);
- CurrentGridData = filteredData.Data as IEnumerable;
- Total = filteredData.Total;
+ var filteredData = await AllGridData.ToDataSourceResultAsync(args.Request);
+ args.Data = filteredData.Data as IEnumerable;
+ args.Total = filteredData.Total;
}
protected override async Task OnInitializedAsync()
@@ -185,7 +185,7 @@ depending on how you filter the data so you may never be able to get back all va
// the actual grid data is retrieve in its OnRead handler
AllGridData = new List();
var rand = new Random();
- for (int i = 0; i < 15; i++)
+ for (int i = 1; i <= 15; i++)
{
AllGridData.Add(new Employee()
{
@@ -227,7 +227,6 @@ depending on how you filter the data so you may never be able to get back all va
````
-
## See Also
* [Grid Filtering Overview]({%slug components/grid/filtering%})
diff --git a/components/grid/grouping/load-on-demand.md b/components/grid/grouping/load-on-demand.md
index 2c684a364a..76ae68e51c 100644
--- a/components/grid/grouping/load-on-demand.md
+++ b/components/grid/grouping/load-on-demand.md
@@ -135,12 +135,11 @@ This example shows how you can combine the virtual row scrolling feature with lo
Scroll through the groups or expand them to load their data on demand
-
@@ -153,7 +152,6 @@ Scroll through the groups or expand them to load their data on demand
@code {
List