|
5 | 5 | <div id="grid">
|
6 | 6 | <QuickGrid @ref="@quickGridRef" Items="@FilteredPeople" Pagination="@pagination" RowClass="HighlightJulie" custom-attrib="somevalue" class="custom-class-attrib">
|
7 | 7 | <PropertyColumn Property="@(p => p.PersonId)" Sortable="true" />
|
8 |
| - <PropertyColumn Property="@(p => p.firstName)" Sortable="true"> |
| 8 | + <PropertyColumn Property="@(p => p.FirstName)" Sortable="true"> |
9 | 9 | <ColumnOptions>
|
10 | 10 | <div class="search-box">
|
11 | 11 | <input type="search" autofocus @bind="firstNameFilter" @bind:event="oninput" placeholder="First name..." />
|
12 | 12 | </div>
|
13 | 13 | <button type="button" id="close-column-options" @onclick="@(() => quickGridRef.CloseColumnOptionsAsync())">Close Column Options</button>
|
14 | 14 | </ColumnOptions>
|
15 | 15 | </PropertyColumn>
|
16 |
| - <PropertyColumn Property="@(p => p.lastName)" Sortable="true" /> |
| 16 | + <PropertyColumn Property="@(p => p.LastName)" Sortable="true" /> |
17 | 17 | <PropertyColumn Property="@(p => p.BirthDate)" Format="yyyy-MM-dd" Sortable="true" />
|
18 | 18 | <PropertyColumn Title="Age in years" Property="@(p => ComputeAge(p.BirthDate))" Sortable="true"/>
|
19 | 19 | </QuickGrid>
|
20 | 20 | </div>
|
21 | 21 | <Paginator State="@pagination" />
|
22 | 22 |
|
23 | 23 | @code {
|
24 |
| - record Person(int PersonId, string firstName, string lastName, DateOnly BirthDate); |
| 24 | + record Person(int PersonId, string FirstName, string LastName, DateOnly BirthDate); |
25 | 25 | PaginationState pagination = new PaginationState { ItemsPerPage = 10 };
|
26 | 26 | string firstNameFilter;
|
27 | 27 | QuickGrid<Person> quickGridRef;
|
28 | 28 |
|
29 | 29 | int ComputeAge(DateOnly birthDate)
|
30 | 30 | => DateTime.Now.Year - birthDate.Year - (birthDate.DayOfYear < DateTime.Now.DayOfYear ? 0 : 1);
|
31 | 31 |
|
32 |
| - string HighlightJulie(Person person) => person.firstName == "Julie" ? "highlight" : null; |
| 32 | + string HighlightJulie(Person person) => person.FirstName == "Julie" ? "highlight" : null; |
33 | 33 |
|
34 | 34 | IQueryable<Person> FilteredPeople
|
35 | 35 | {
|
|
39 | 39 |
|
40 | 40 | if (!string.IsNullOrEmpty(firstNameFilter))
|
41 | 41 | {
|
42 |
| - result = result.Where(p => p.firstName.Contains(firstNameFilter, StringComparison.CurrentCultureIgnoreCase)); |
| 42 | + result = result.Where(p => p.FirstName.Contains(firstNameFilter, StringComparison.CurrentCultureIgnoreCase)); |
43 | 43 | }
|
44 | 44 |
|
45 | 45 | return result;
|
|
0 commit comments