I am creating a Grid in an MVC project (Razor). I attempt to create a custom filterdescriptor to have a default filter, as part of the grid definition, like
.Filtering(filter =>
{
filter.AllowFiltering(true);
filter.FilterMode(FilterMode.FilterBar);
filter.FilterBarMode(FilterBarMode.OnEnter);
filter.FilterDescriptors(descriptor =>
{
descriptor.Add(new FilterDescriptor("Group") { ColumnName = "Group", IsCaseSensitive = false, Operator = Syncfusion.Linq.FilterType.StartsWith, Predicate = PredicateType.And, Value = "C" });
});
})
note the fluent .Add call ends up with the same result
descriptor.Add(d => d.Group).MatchCase(false).FilterBy(Syncfusion.Linq.FilterType.Contains).Predicate(PredicateType.And).FilterValue("C");
When I attempt to page (or POST any grid operations), I get a 500 in response from .GridActions<>. When looking at the PagingParams passed to the action method, the FilterDescriptor corresponding to the one defined in the code above has a null ColumnName. args.FilterObject ==
"[{\"Column\":\"Group\",\"Operator\":6,\"Predicate\":0,\"Value\":\"C\",\"IsCaseSensitive\":false}]"
If, however, I do not create the descriptor in the definition, and through the FilterBar filter the Group field to C (so, do what results in exactly the same records), when POSTing, the FilterDescriptor corresponding to Group has a ColumnName = "Group" and arg.FilterObject ==
"[{\"ColumnName\":\"Group\",\"Operator\":\"6\",\"Value\":\"C\",\"Predicate\":\"0\",\"IsCaseSensitive\":false}]"
Note the FilterObject property is the same except the FilterBar FilterDescriptor version has "ColumnName" instead of "Column".
So, either I am doing something wrong or there is a bug in the FilterDescriptor.Add tree.
Suggestions on what to do to either (a) be correct or (b) work around?
thanks