Skip to content

FluentDataGrid: Filter indicator not shown on TemplateColumn without SortBy #4501

@ggomong

Description

@ggomong

Description

When using TemplateColumn with Filtered property but without SortBy, the filter indicator icon is not displayed in the column header, even when a filter is active.

Steps to Reproduce

  1. Create a FluentDataGrid with a TemplateColumn
  2. Add ColumnOptions with filter controls (e.g., FluentRadioGroup)
  3. Set Filtered property to indicate filter state
  4. Do NOT set SortBy or Sortable
<FluentDataGrid ItemsProvider="@ItemsProvider" TGridItem="MyItem">
    <TemplateColumn Title="Status" Filtered="@(statusFilter.HasValue)">
        <ColumnOptions>
            <FluentRadioGroup @bind-Value="statusFilterValue">
                <FluentRadio Value="@("")">All</FluentRadio>
                <FluentRadio Value="@("active")">Active</FluentRadio>
                <FluentRadio Value="@("inactive")">Inactive</FluentRadio>
            </FluentRadioGroup>
        </ColumnOptions>
        <ChildContent>
            @context.Status
        </ChildContent>
    </TemplateColumn>
</FluentDataGrid>

Expected Behavior

The filter indicator icon should appear in the column header when Filtered is true, regardless of whether SortBy is defined.

Actual Behavior

The filter indicator icon is NOT displayed because:

  • The filter indicator is rendered inside col-sort-button element
  • col-sort-button is only created when the column is sortable
  • Without SortBy, only col-title div is rendered, which has no place for the filter indicator

HTML comparison (filter applied):

PropertyColumn with Sortable (indicator shown):

<fluent-button class="col-sort-button">
  <div class="col-title-text">Title</div>
  <svg slot="end">Sort arrow</svg>
  <svg slot="end">Filter indicator <- SHOWN</svg>
</fluent-button>

TemplateColumn without SortBy (indicator NOT shown):

<fluent-button class="col-options-button">Filter icon</fluent-button>
<div class="col-title">Status</div>  <!-- No place for filter indicator -->

Workaround

Add a dummy SortBy to the TemplateColumn:

<TemplateColumn Title="Status" 
                SortBy="@(GridSort<MyItem>.ByAscending(x => x.Status))"
                Filtered="@(statusFilter.HasValue)">

Environment

  • Package version: 4.13.2
  • .NET version: .NET 10
  • Browser: Chrome, Edge (all browsers)

Suggested Fix

The filter indicator should be rendered in a location that does not depend on the column being sortable. Perhaps in col-title or as a separate element alongside col-options-button.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: repro code or repositoryThe provided description or code is insufficient to repro the issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions