Closed andresfranco closed 10 months ago
You are not using the column definition on the server side. If your grid component name is Movies.razor:
[HttpGet]
public ActionResult<List<Movie>> Get()
{
var movies = _service.GetAllMovies();
var server = new GridServer<Movie>(movies, Request.Query, true, "moviesGrid", Movies.Columns)
.Sortable()
.Filterable()
.WithMultipleFilters()
.Searchable();
return Ok(server.ItemsToDisplay);
}
I think this is the source of your error.
On the other side you don't need this code on the client side:
var queryParams = new Dictionary<string, string> {{"page", "2"}};
var query = new QueryDictionary<StringValues>();
foreach (var kvp in queryParams)
{
query.Add(kvp.Key, new StringValues(kvp.Value));
}
I am trying to understand how to implement the Grid in my project . The data is fetched from a REST API (both projects are using .netcore 7). Although the grid populates successfully when I run my project, I'm facing an issue with the sorting functionality.
When I click on a column to sort, it seems to execute the same initial query used to populate the grid. As a result, the sorting feature doesn't work as expected. I've checked the debug output in Visual Studio but haven't been able to identify what might be causing the problem.
Could someone please guide me on how to properly set up the sorting functionality with Grid.Blazor? Any help or suggestions would be greatly appreciated.
This is my Blazor component code :
This is This is my API Rest controller method: