1+ <Grid TItem =" Employee3"
2+ Class =" table table-hover table-bordered table-striped"
3+ DataProvider =" EmployeesDataProvider"
4+ AllowFiltering =" false"
5+ Responsive =" true" >
6+
7+ <GridColumns >
8+ <GridColumn TItem =" Employee3" HeaderText =" Id" PropertyName =" Id" FilterTextboxWidth =" 80" >
9+ @context.Id
10+ </GridColumn >
11+ <GridColumn TItem =" Employee3" HeaderText =" First Name" PropertyName =" FirstName" FilterTextboxWidth =" 80" >
12+ @context.FirstName
13+ </GridColumn >
14+ <GridColumn TItem =" Employee3" HeaderText =" Last Name" PropertyName =" LastName" FilterTextboxWidth =" 80" >
15+ @context.LastName
16+ </GridColumn >
17+ <GridColumn TItem =" Employee3" HeaderText =" Salary" HeaderTextAlignment =" Alignment.End" TextAlignment =" Alignment.End" PropertyName =" Salary" >
18+ <CurrencyInput Style =" width:120px;" TextAlignment =" Alignment.End" Value =" @context.Salary" ValueExpression =" () => context.Salary" />
19+ </GridColumn >
20+ <GridColumn TItem =" Employee3" HeaderText =" Email" PropertyName =" Email" >
21+ @context.Email
22+ </GridColumn >
23+ <GridColumn TItem =" Employee3" HeaderText =" Company" TextNoWrap =" true" PropertyName =" Company" >
24+ @context.Company
25+ </GridColumn >
26+ <GridColumn TItem =" Employee3" HeaderText =" Designation" TextNoWrap =" true" PropertyName =" Designation" >
27+ @context.Designation
28+ </GridColumn >
29+ <GridColumn TItem =" Employee3" HeaderText =" DOJ" PropertyName =" DOJ" >
30+ @context.DOJ
31+ </GridColumn >
32+ <GridColumn TItem =" Employee3" HeaderText =" Active" HeaderTextAlignment =" Alignment.Center" TextAlignment =" Alignment.Center" PropertyName =" IsActive" >
33+ @context.IsActive
34+ </GridColumn >
35+ </GridColumns >
36+
37+ </Grid >
38+
39+ @code {
40+ private IEnumerable <Employee3 >? employees ;
41+
42+ private async Task <GridDataProviderResult <Employee3 >> EmployeesDataProvider (GridDataProviderRequest < Employee3 > request )
43+ {
44+ if (employees is null ) // pull employees only one time for client-side filtering, sorting, and paging
45+ employees = GetEmployees (); // call a service or an API to pull the employees
46+
47+ return await Task .FromResult (request .ApplyTo (employees ));
48+ }
49+
50+ private IEnumerable <Employee3 > GetEmployees ()
51+ {
52+ return new List <Employee3 >
53+ {
54+ new Employee3 {
Id = 107 ,
FirstName = " Alice" ,
LastName = " Reddy" ,
Email = " [email protected] " ,
Company = " BlazorBootstrap Company" ,
Designation = " AI Engineer" ,
DOJ = new DateOnly (
1998 ,
11 ,
17 ),
Salary = 7700 ,
IsActive = true },
55+ new Employee3 {
Id = 103 ,
FirstName = " Bob" ,
LastName = " Roy" ,
Email = " [email protected] " ,
Company = " BlazorBootstrap Company" ,
Designation = " Senior DevOps Engineer" ,
DOJ = new DateOnly (
1985 ,
1 ,
5 ),
Salary = 19000 ,
IsActive = true },
56+ new Employee3 {
Id = 106 ,
FirstName = " John" ,
LastName = " P" ,
Email = " [email protected] " ,
Company = " BlazorBootstrap Company" ,
Designation = " Data Engineer" ,
DOJ = new DateOnly (
1995 ,
4 ,
17 ),
Salary = 12000 ,
IsActive = true },
57+ new Employee3 {
Id = 104 ,
FirstName = " Pop" ,
LastName = " Two" ,
Email = " [email protected] " ,
Company = " BlazorBootstrap Company" ,
Designation = " Associate Architect" ,
DOJ = new DateOnly (
1985 ,
6 ,
8 ),
Salary = 19000 ,
IsActive = false },
58+ new Employee3 {
Id = 105 ,
FirstName = " Ronald" ,
LastName = " Dire" ,
Email = " [email protected] " ,
Company = " BlazorBootstrap Company" ,
Designation = " Senior Data Engineer" ,
DOJ = new DateOnly (
1991 ,
8 ,
23 ),
Salary = 16500 ,
IsActive = true },
59+ new Employee3 {
Id = 102 ,
FirstName = " Line" ,
LastName = " K" ,
Email = " [email protected] " ,
Company = " BlazorBootstrap Company" ,
Designation = " Architect" ,
DOJ = new DateOnly (
1977 ,
1 ,
12 ),
Salary = 24000 ,
IsActive = true },
60+ new Employee3 {
Id = 101 ,
FirstName = " Daniel" ,
LastName = " Potter" ,
Email = " [email protected] " ,
Company = " BlazorBootstrap Company" ,
Designation = " Architect" ,
DOJ = new DateOnly (
1977 ,
1 ,
12 ),
Salary = 21000 ,
IsActive = true },
61+ new Employee3 {
Id = 108 ,
FirstName = " Zayne" ,
LastName = " Simmons" ,
Email = " [email protected] " ,
Company = " BlazorBootstrap Company" ,
Designation = " Data Analyst" ,
DOJ = new DateOnly (
1991 ,
1 ,
1 ),
Salary = 17850 ,
IsActive = true },
62+ new Employee3 {
Id = 109 ,
FirstName = " Isha" ,
LastName = " Davison" ,
Email = " [email protected] " ,
Company = " BlazorBootstrap Company" ,
Designation = " App Maker" ,
DOJ = new DateOnly (
1996 ,
7 ,
1 ),
Salary = 8000 ,
IsActive = true },
63+ };
64+ }
65+ }
0 commit comments