RadzenGridColumn - Add UseFilterTemplate parameter

In a situation where I am creating the RadzenGridColumn components with a @foreach loop, I have no way to use the FilterTemplate on only some of the columns. Due to a Blazor limitation, I cannot put the FilterTemplate inside a @if and if I put the @if inside the FilterTemplate, then the columns without a custom filter will have nothing appear when the filter button is pressed; and what I want is for those columns to get a default filter as FilterTemplate had never been used.

What would be useful, would be to have a bool paramter on RadzenGridColumn, which lets the component know whether to use the FilterTemplate or to ignore it. It's default value could be true, so default functionality remains the same. That way, with my @foreach scenario, I would not need to use the @if at all, and just set the parameter to false for any columns I want to ignore the FilterTemplate and use the default filter.

Not sure I understand what is the limitation you are describing. Can you post some code as an example?

So as shown below, the @if has to be inside the FilterTemplate. It cannot be placed outside the FilterTemplate due to how Blazor works. But this means, on column's where UseDropDownFilter is true, the custom filter is available, but on the others, where the contents of FilterTemplate is blank, that column has a filter button, but when pressed, nothing appears.

<RadzenGrid>
    <Columns>
        @foreach (var column in ColumnList)
        {
            <RadzenGridColumn>
                <FilterTemplate>
                    @if (columnItem.UseDropDownFilter)
                    {
                        <RadzenDropDown />
                    }
                </FilterTemplate>
            </RadzenGridColumn>
        }
    </Columns>
</RadzenGrid>

Now again, this is limitation in Blazor, that a RenderFragment can only be determined as empty if its "null" which only happens if its not on the markup at all. Due to the fact I cannot place the @if around the FilterTemplate but inside, I'm putting it in the markup for every column, so its not "null" for every column, but it is empty.

A way round this would be to have a bool on the RadzenGridColumn implemented by yourselves, so you could also use that to identify if the user wants to render the FilterTemplate or not.

<RadzenGrid>
    <Columns>
        @foreach (var column in ColumnList)
        {
            <RadzenGridColumn UseFilterTemplate=@columnItem.UseDropDownFilter>
                <FilterTemplate>
                    @if (columnItem.UseDropDownFilter)
                    {
                        <RadzenDropDown />
                    }
                </FilterTemplate>
            </RadzenGridColumn>
        }
    </Columns>
</RadzenGrid>

Maybe you should have the whole column inside if with or without FilterTemplate depending on your condition.

That is actually what I've done, but my actual RadzenGridColumn markup is alot more complex than the example I provided, and it requires me to duplicate it. One version with the FilterTemplate, and an identical version without the FilterTemplate. I just feel a solution that would avoid code duplication would be more elegant.