From 258f1b5dec2cf691c6c6f477a4c568ec3665cfeb Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Wed, 30 Oct 2019 18:29:55 +0200 Subject: [PATCH] demos updated --- LatestBlazor.csproj | 2 +- Pages/AutocompletePage.razor | 2 +- Pages/DataGridLoadDataPage.razor | 57 ++++++++++++++++++++++++++++++++ Pages/DropDownDataGridPage.razor | 8 ++--- Pages/DropDownPage.razor | 12 +++---- Pages/ListBoxPage.razor | 4 +-- Shared/MainLayout.razor | 35 ++++++++++++-------- 7 files changed, 92 insertions(+), 28 deletions(-) create mode 100644 Pages/DataGridLoadDataPage.razor diff --git a/LatestBlazor.csproj b/LatestBlazor.csproj index 089453513c4..9391e9b35b6 100644 --- a/LatestBlazor.csproj +++ b/LatestBlazor.csproj @@ -6,7 +6,7 @@ - + diff --git a/Pages/AutocompletePage.razor b/Pages/AutocompletePage.razor index 97fcd9b78a6..487ae15ea63 100644 --- a/Pages/AutocompletePage.razor +++ b/Pages/AutocompletePage.razor @@ -13,7 +13,7 @@

AutoComplete

- +

AutoComplete with placeholder

diff --git a/Pages/DataGridLoadDataPage.razor b/Pages/DataGridLoadDataPage.razor new file mode 100644 index 00000000000..83e5552c284 --- /dev/null +++ b/Pages/DataGridLoadDataPage.razor @@ -0,0 +1,57 @@ +@page "/datagrid-loaddata" +@using NorthwindBlazor.Data +@using NorthwindBlazor.Models.Northwind + +@inject NorthwindContext dbContext + +

DataGrid

[source code][documentation] + +

This page demonstrates DataGrid component bound using LoadData event. This technique can be used to populate data from external source like service.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +@code { + int count; + IEnumerable employees; + + protected override async Task OnInitializedAsync() + { + count = await Task.FromResult(dbContext.Employees.Count()); + } + + private async void LoadData(LoadDataArgs args) + { + employees = await Task.FromResult(dbContext.Employees.Skip(args.Skip.Value).Take(args.Top.Value)); + } +} diff --git a/Pages/DropDownDataGridPage.razor b/Pages/DropDownDataGridPage.razor index ff54417c83e..b29a9ddd07c 100644 --- a/Pages/DropDownDataGridPage.razor +++ b/Pages/DropDownDataGridPage.razor @@ -13,13 +13,13 @@

DropDownDataGrid

- +

DropDownDataGrid with placeholder

- +

DropDownDataGrid with template

-