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({
});

DevExtreme widgets are integrated with many popular libraries and frameworks. See the Installation section (for JavaScript libraries) or the Prerequisites and Installation section (for ASP.NET MVC framework) to find details on setting up DevExtreme with a particular library or framework.

The following code shows how to create the FilterBuilder widget using every supported library and framework. For more details on working with widgets in these libraries and frameworks, see the Widget Basics topic for jQuery, Angular, AngularJS, Knockout or ASP.NET MVC.

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.

Type:

Object