Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Server-side filtering with Angular 6 ag-grid and ASP.NET and EF Core 2.1

I am trying to implement server-side filtering in ag-grid (infinite scrolling mode).

Problem is - documentation about filterModel is very obscure and I am slowly discovering things using console.log which is getting frustrating because of different information filterModel can provide which also makes mapping to server side classes very tedious. Has anyone found proper documentation about filterModel?

Also, has anyone found helper methods for ASP.NET Core and EF Core to apply this filterModel? It seems like A LOT of work to cover every possible scenario and my current approach requires System.DynamicLinq (not sure if this is optimal solution).

Thanks, Mario

like image 643
mariob Avatar asked Dec 01 '22 14:12

mariob


1 Answers

Here are all models I used for grid.

    public class SortModel
{
    public string colId { get; set; }
    public string sort { get; set; }
}

public class FilterModel
{
    public FilterModel condition1 { get; set; }
    public FilterModel condition2 { get; set; }
    [JsonProperty("operator")]
    public string logicOperator { get; set; }
    public string type { get; set; }
    public string filter { get; set; }
    public string filterTo { get; set; }
    public DateTime? dateFrom { get; set; }
    public DateTime? dateTo { get; set; }
    public string filterType { get; set; }
}

public class GridOperationsModel
{
    public int startRow { get; set; }
    public int endRow { get; set; }
    public SortModel[] sortModel { get; set; }
    public Dictionary<string, FilterModel> filterModel { get; set; }
}
like image 51
mariob Avatar answered Dec 06 '22 11:12

mariob