We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug Example, I have an employee who has a relationship with the jobs table. I want to filter by job name, how to do it?
I tried:
public class Job { public int Id { get; set; } public string Name { get; set; } } public class Employee { public int Id { get; set; } public int JobId { get; set; } public virtual Job Job { get; set; } }
Versions (please complete the following information):
Sample code
@rendermode InteractiveServer @page "/sample" @attribute [StreamRendering] <Grid @ref="grid" TItem="Employee" Class="table table-hover table-bordered table-striped" DataProvider="EmployeesDataProvider" AllowFiltering="true" Responsive="true" AllowPaging="true" PageSize="20" AllowSorting="true" EmptyText="No hay registros para mostrar" ItemsPerPageText="Items por página" Height="500" AutoHidePaging="true" FixedHeader="true" PageSizeSelectorItems="@(new int[] { 5,10,20 })" PaginationItemsTextFormat="{0} - {1} de {2} items"> <GridColumn TItem="Employee" HeaderText="Id" PropertyName="Id"> @context.Id </GridColumn> <GridColumn TItem="Employee" HeaderText="Job" PropertyName="Job.Name"> @context.Job.Name </GridColumn> </Grid> @code { BlazorBootstrap.Grid<Employee> grid = default!; private IEnumerable<Employee> employees = default!; protected override async Task OnAfterRenderAsync(bool firstRender) { await base.OnAfterRenderAsync(firstRender); } private async Task<GridDataProviderResult<Employee>> EmployeesDataProvider(GridDataProviderRequest<Employee> request) { if (employees is null) // pull employees only one time for client-side filtering, sorting, and paging employees = GetEmployees(); // call a service or an API to pull the employees return await Task.FromResult(request.ApplyTo(employees)); } private IEnumerable<Employee> GetEmployees() { List<Job> jobs = new List<Job> { new Job { Id = 1, Name = "Software Developer" }, new Job { Id = 2, Name = "Database Administrator" }, }; return new List<Employee> { new Employee { Id = 107, JobId = 1, Job = jobs.Find(job => job.Id == 1) }, new Employee { Id = 108, JobId = 2, Job = jobs.Find(job => job.Id == 2) }, }; } public class Job { public int Id { get; set; } public string Name { get; set; } } public class Employee { public int Id { get; set; } public int JobId { get; set; } public virtual Job Job { get; set; } } }
The text was updated successfully, but these errors were encountered:
Are there any plans to support this @gvreddy04? Would be a good feature to see!
Sorry, something went wrong.
@OllieFox131 Yes, we will include it in the April/May release. We are planning more grid enhancements during the April/May timeframe.
No branches or pull requests
Describe the bug
Example, I have an employee who has a relationship with the jobs table.
I want to filter by job name, how to do it?
I tried:
SortKeySelector="item => item.Job.Name"
Versions (please complete the following information):
Sample code
The text was updated successfully, but these errors were encountered: