FilterBuilder

The FilterBuilder widget allows a user to build complex filter expressions with an unlimited number of filter conditions, combined by logical operations using the UI.

Export: default
FilterBuilder interactive configuration
Copy Code
Copy to Codepen
$("#filterbuilder").dxFilterBuilder({
});

You can create a widget using one of the following approaches:

jQuery
JavaScript
HTML
$(function () {
    $("#filterBuilder").dxFilterBuilder({
        value: ["Category", "contains", "Tel"],
        fields: [{
            dataField: "Category"
        }, {
            dataField: "Shipped",
            caption: "Shipment Date",
            dataType: "date"
        }, {
            dataField: "UnitPrice",
            dataType: "number"
        }]
    });
});
<div id="filterBuilder"></div>
Angular
HTML
TypeScript
<dx-filter-builder
    [value]='["Category", "contains", "Tel"]'>
    <dxi-field
        dataField="Category">
    </dxi-field>
    <dxi-field
        dataField="Shipped"
        caption="Shipment Date"
        dataType="date">
    </dxi-field>
    <dxi-field
        dataField="UnitPrice"
        dataType="number">
    </dxi-field>
</dx-filter-builder>
import { DxFilterBuilderModule } from 'devextreme-angular';
// ...
export class AppComponent {
    // ...
}
@NgModule({
    imports: [
        // ...
        DxFilterBuilderModule
    ],
    // ...
})
AngularJS
HTML
<div ng-controller="DemoController">
    <div dx-filter-builder="{
        value: ['Category', 'contains', 'Tel'],
        fields: [{
            dataField: 'Category'
        }, {
            dataField: 'Shipped',
            caption: 'Shipment Date',
            dataType: 'date'
        }, {
            dataField: 'UnitPrice',
            dataType: 'number'
        }]
    }"></div>
</div>
Knockout
HTML
<div data-bind="dxFilterBuilder: {
    value: ['Category', 'contains', 'Tel'],
    fields: [{
        dataField: 'Category'
    }, {
        dataField: 'Shipped',
        caption: 'Shipment Date',
        dataType: 'date'
    }, {
        dataField: 'UnitPrice',
        dataType: 'number'
    }]
}"></div>
ASP.NET MVC Controls
Razor C#
Razor VB
@(Html.DevExtreme().FilterBuilder()
    .ID("filterBuilder")
    .Value(new object[] { "Category", "contains", "Tel" })
    .Fields(fields => {
        fields.Add().DataField("CompanyName");
        fields.Add()
                .DataField("City")
                .Caption("Shipment Date")
                .DataType(FilterBuilderFieldDataType.Date);
        fields.Add()
                .DataField("State");
                .DataType(FilterBuilderFieldDataType.Number);
    })
)
@(Html.DevExtreme().FilterBuilder() _
    .ID("filterBuilder") _
    .Value(new object[] { "Category", "contains", "Tel" }) _
    .Fields(Sub(fields)
        fields.Add().DataField("CompanyName")
        fields.Add()
                .DataField("City")
                .Caption("Shipment Date")
                .DataType(FilterBuilderFieldDataType.Date)
        fields.Add()
                .DataField("State");
                .DataType(FilterBuilderFieldDataType.Number)
    End Sub)
)
See Also

Configuration

An object defining the FilterBuilder widget's configuration options.

Methods

This section describes members used to manipulate the widget.

Events

This section describes the events this widget raises.

See Also

Field

The FilterBuilder's field structure.