Skip to content

Instantly share code, notes, and snippets.

@vnbaaij
Created November 30, 2022 20:51
Show Gist options
  • Save vnbaaij/7fd400c758be2fdfc133c36a71d56368 to your computer and use it in GitHub Desktop.
Save vnbaaij/7fd400c758be2fdfc133c36a71d56368 to your computer and use it in GitHub Desktop.
Old grid definition
<FluentDataGrid id="defaultGrid" RowsData=RowsGrid ColumnDefinitions=ColumnsGrid GridTemplateColumns="1fr 1fr" /> @code {
record Person(int PersonId, string Name, DateOnly BirthDate);
public List<ColumnDefinition<Person>> ColumnsGrid = new();
IQueryable<Person> people = new[]
{
new Person(10895, "Jean Martin", new DateOnly(1985, 3, 16)),
new Person(10944, "António Langa", new DateOnly(1991, 12, 1)),
new Person(11203, "Julie Smith", new DateOnly(1958, 10, 10)),
new Person(11205, "Nur Sari", new DateOnly(1922, 4, 27)),
new Person(11898, "Jose Hernandez", new DateOnly(2011, 5, 3)),
new Person(12130, "Kenji Sato", new DateOnly(2004, 1, 9)),
}.AsQueryable();
protected override void OnInitialized()
{
ColumnsGrid.Add(new ColumnDefinition<Person>("Id", x => x.PersonId));
ColumnsGrid.Add(new ColumnDefinition<Person>("Name", x => x.Name));
ColumnsGrid.Add(new ColumnDefinition<Person>("Birthdate", x => x.BirthDate));
base.OnInitialized();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment