Back to Devexpress

DxFilterBuilderField.IsCollection Property

blazor-devexpress-dot-blazor-dot-dxfilterbuilderfield-5628b431.md

latest3.6 KB
Original Source

DxFilterBuilderField.IsCollection Property

Specifies whether the field stores object collections.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
[DefaultValue(false)]
[Parameter]
public bool IsCollection { get; set; }

Property Value

TypeDefaultDescription
Booleanfalse

true if the field stores object collections; otherwise, false.

|

Remarks

Enable the IsCollection property to define a collection field. Such field stores an object collection and supports aggregate operators (functions). Aggregate functions calculate collection summaries and allow users to create filter conditions based on the aggregated results. For example, users can filter out invoices containing fewer than 5 items in the Products field.

The following aggregate functions are available:

ExistsReturns true if the collection contains at least one field (object).CountCalculates the number of fields (objects) in the collection.AvgCalculates the average of all values in the collection.SumCalculates the total sum of all values in the collection.MinReturns the minimum value in the collection.MaxReturns the maximum value in the collection.

For additional information about available operators in Blazor Filter Builder, refer to the following article: Filter Operators in Blazor Filter Builder.

Note

For a collection field, the Filter Builder automatically sets its Type property to @typeof(List<object>) and hides the nested hierarchy in the UI.

The following code snippet defines an Orders collection field:

razor
<DxFilterBuilder @bind-FilterCriteria="FilterCriteria">
    <Fields>
        <DxFilterBuilderField FieldName="ProductName" Caption="Product" Type="@typeof(string)" />
        <DxFilterBuilderField FieldName="UnitPrice" Caption="Unit Price" Type="@typeof(decimal)" />
        <DxFilterBuilderField FieldName="UnitsInStock" Caption="Units In Stock" Type="@typeof(int)" />
        <DxFilterBuilderField FieldName="Orders" Caption="Orders" IsCollection="true">
            <Fields>
                <DxFilterBuilderField FieldName="OrderDate" Caption="Order Date" Type="@typeof(DateTime?)" />
                <DxFilterBuilderField FieldName="CustomerName" Caption="Customer" Type="@typeof(string)" />
                <DxFilterBuilderField FieldName="Quantity" Caption="Quantity" Type="@typeof(int)" />
            </Fields>
        </DxFilterBuilderField>
    </Fields>
</DxFilterBuilder>

Run Demo: Filter Builder - Collection Fields and Aggregate Operators

See Also

DxFilterBuilderField Class

DxFilterBuilderField Members

DevExpress.Blazor Namespace