Skip to content

Ensure FirstName and LastName Follow Pascal Case in QuickGrid Component #60340

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

Merged
merged 1 commit into from
Feb 13, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@
<div id="grid">
<QuickGrid @ref="@quickGridRef" Items="@FilteredPeople" Pagination="@pagination" RowClass="HighlightJulie" custom-attrib="somevalue" class="custom-class-attrib">
<PropertyColumn Property="@(p => p.PersonId)" Sortable="true" />
<PropertyColumn Property="@(p => p.firstName)" Sortable="true">
<PropertyColumn Property="@(p => p.FirstName)" Sortable="true">
<ColumnOptions>
<div class="search-box">
<input type="search" autofocus @bind="firstNameFilter" @bind:event="oninput" placeholder="First name..." />
</div>
<button type="button" id="close-column-options" @onclick="@(() => quickGridRef.CloseColumnOptionsAsync())">Close Column Options</button>
</ColumnOptions>
</PropertyColumn>
<PropertyColumn Property="@(p => p.lastName)" Sortable="true" />
<PropertyColumn Property="@(p => p.LastName)" Sortable="true" />
<PropertyColumn Property="@(p => p.BirthDate)" Format="yyyy-MM-dd" Sortable="true" />
<PropertyColumn Title="Age in years" Property="@(p => ComputeAge(p.BirthDate))" Sortable="true"/>
</QuickGrid>
</div>
<Paginator State="@pagination" />

@code {
record Person(int PersonId, string firstName, string lastName, DateOnly BirthDate);
record Person(int PersonId, string FirstName, string LastName, DateOnly BirthDate);
PaginationState pagination = new PaginationState { ItemsPerPage = 10 };
string firstNameFilter;
QuickGrid<Person> quickGridRef;

int ComputeAge(DateOnly birthDate)
=> DateTime.Now.Year - birthDate.Year - (birthDate.DayOfYear < DateTime.Now.DayOfYear ? 0 : 1);

string HighlightJulie(Person person) => person.firstName == "Julie" ? "highlight" : null;
string HighlightJulie(Person person) => person.FirstName == "Julie" ? "highlight" : null;

IQueryable<Person> FilteredPeople
{
Expand All @@ -39,7 +39,7 @@

if (!string.IsNullOrEmpty(firstNameFilter))
{
result = result.Where(p => p.firstName.Contains(firstNameFilter, StringComparison.CurrentCultureIgnoreCase));
result = result.Where(p => p.FirstName.Contains(firstNameFilter, StringComparison.CurrentCultureIgnoreCase));
}

return result;
Expand Down
Loading