Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Prevent filtering out certain rows in Blazor Syncfusion DataGrid

$
0
0

I'm looking to remove certain filter choices in filter menu in Blazor Syncfusion DataGrid so that users cannot unselect them.

I basically want: "The top N records based on sort order should not be able to be filtered out".

To demonstrate what I'm looking for, I created this repro with the grid.

https://blazorplayground.syncfusion.com/VtVoNmCjPZjeFpML

Now I want Model2Ord1 whose sort order is 1 to NOT be able to be filtered out.

I want something like this where Model2Ord1 is removed/ not visible on the filter choices, but other choices are visible:

Basically, I'd like to do something like below, but it doesn't work:

// Reference: https://blazor.syncfusion.com/documentation/datagrid/filter-menu#filter-menu-eventspublic void FilterDialogOpeningHandler(FilterDialogOpeningEventArgs args){    // Only allow filtering on models that have ForecastOrder > 1    args.CheckboxListData = gridData.Where(d => d.SortOrder > 1).Select(d => d.Model).ToList();}

I need help accomplishing these 2 things:

  1. Remove filter choices based on certain logic (sort order in this case), so user can never filter out certain choices, and those records are always visible.
  2. Make sure the filter choices appear based on the sort order of gridData. Currently as you can see, the filter choices appear as Model1Ord2, Model2Ord1, Model3Ord4, Model4Ord3.I want them to show up in correct order like: Model2Ord1 (Obviously I want this hidden/removed), Model1Ord2, Model4Ord3, Model3Ord4.

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>