A newer version of this page is available. Switch to the current version.

JavaScript/jQuery FilterBuilder Options

An object defining the FilterBuilder UI component's configuration properties.

See Also

accessKey

Specifies the shortcut key that sets focus on the UI component.

Type:

String

Default Value: undefined

The value of this property will be passed to the accesskey attribute of the HTML element that underlies the UI component.

activeStateEnabled

Specifies whether the UI component changes its state as a result of user interaction.

Type:

Boolean

Default Value: false

The UI component switches to the active state when users press down the primary mouse button. When this property is set to true, the CSS rules for the active state apply. You can change these rules to customize the component.

Use this property when you display the component on a platform whose guidelines include the active state change for UI components. See the following GitHub repository for an example of this type of platform: MUI.

allowHierarchicalFields

Specifies whether the UI component can display hierarchical data fields.

Type:

Boolean

Default Value: false

customOperations[]

Configures custom filter operations.

Default Value: []

disabled

Specifies whether the UI component responds to user interaction.

Type:

Boolean

Default Value: false

elementAttr

Specifies the global attributes to be attached to the UI component's container element.

Type: any
Default Value: {}

jQuery
$(function(){
    $("#filterBuilderContainer").dxFilterBuilder({
        // ...
        elementAttr: {
            id: "elementId",
            class: "class-name"
        }
    });
});
Angular
HTML
TypeScript
<dx-filter-builder ...
    [elementAttr]="{ id: 'elementId', class: 'class-name' }">
</dx-filter-builder>
import { DxFilterBuilderModule } from "devextreme-angular";
// ...
export class AppComponent {
    // ...
}
@NgModule({
    imports: [
        // ...
        DxFilterBuilderModule
    ],
    // ...
})
Vue
App.vue
<template>
    <DxFilterBuilder ...
        :element-attr="filterBuilderAttributes">
    </DxFilterBuilder>
</template>

<script>
import DxFilterBuilder from 'devextreme-vue/filter-builder';

export default {
    components: {
        DxFilterBuilder
    },
    data() {
        return {
            filterBuilderAttributes: {
                id: 'elementId',
                class: 'class-name'
            }
        }
    }
}
</script>
React
App.js
import React from 'react';

import FilterBuilder from 'devextreme-react/filter-builder';

class App extends React.Component {
    filterBuilderAttributes = {
        id: 'elementId',
        class: 'class-name'
    }

    render() {
        return (
            <FilterBuilder ...
                elementAttr={this.filterBuilderAttributes}>
            </FilterBuilder>
        );
    }
}
export default App;

fields[]

Configures fields.

Default Value: []

This property accepts an array of objects, each configuring a filter condition's appearance. Each condition consists of a data field, operation and value. A logical operation can combine conditions on the same level in a group.

DevExtreme HTML5 JavaScript Filter Builder Fields

See the Field section for details on fields you can specify in each object.

View Demo

filterOperationDescriptions

Specifies filter operation descriptions.

Type:

Object

The following code sample illustrates how to set this property:

jQuery
index.js
$(function() {
    $("#filterBuilderContainer").dxFilterBuilder({
        // ...
        filterOperationDescriptions: {
            startsWith: "Begins with"
        }
    });
});
Angular
app.component.html
app.module.ts
<dx-filter-builder ... >
    <dxo-filter-operation-descriptions
        startsWith="Begins with">
    </dxo-filter-operation-descriptions>
</dx-filter-builder>
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

import { DxFilterBuilderModule } from 'devextreme-angular';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        DxFilterBuilderModule
    ],
    providers: [ ],
    bootstrap: [AppComponent]
})
export class AppModule { }
Vue
App.vue
<template>
    <DxFilterBuilder ... >
        <DxFilterOperationDescriptions
            starts-with="Begins with"
        />
    </DxFilterBuilder>
</template>

<script>
import 'devextreme/dist/css/dx.light.css';

import DxFilterBuilder, {
    DxFilterOperationDescriptions
} from 'devextreme-vue/filter-builder';

export default {
    components: {
        DxFilterBuilder,
        DxFilterOperationDescriptions
    },
    // ...
}
</script>
React
App.js
import 'devextreme/dist/css/dx.light.css';

import FilterBuilder, {
    FilterOperationDescriptions
} from 'devextreme-react/filter-builder';

export default function App() {
    return (
        <FilterBuilder ... >
            <FilterOperationDescriptions
                startsWith="Begins with"
            />
        </FilterBuilder>
    );
}
See Also

focusStateEnabled

Specifies whether the UI component can be focused using keyboard navigation.

Type:

Boolean

Default Value: false

groupOperationDescriptions

Specifies group operation descriptions.

Type:

Object

The following code sample illustrates how to set this property:

jQuery
index.js
$(function() {
    $("#filterBuilderContainer").dxFilterBuilder({
        // ...
        groupOperationDescriptions: {
            and: "Plus"
        }
    });
});
Angular
app.component.html
app.module.ts
<dx-filter-builder ... >
    <dxo-group-operation-descriptions
        and="Plus">
    </dxo-group-operation-descriptions>
</dx-filter-builder>
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';

import { DxFilterBuilderModule } from 'devextreme-angular';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        DxFilterBuilderModule
    ],
    providers: [ ],
    bootstrap: [AppComponent]
})
export class AppModule { }
Vue
App.vue
<template>
    <DxFilterBuilder ... >
        <DxGroupOperationDescriptions
            and="Plus"
        />
    </DxFilterBuilder>
</template>

<script>
import 'devextreme/dist/css/dx.light.css';

import DxFilterBuilder, {
    DxGroupOperationDescriptions
} from 'devextreme-vue/filter-builder';

export default {
    components: {
        DxFilterBuilder,
        DxGroupOperationDescriptions
    },
    // ...
}
</script>
React
App.js
import 'devextreme/dist/css/dx.light.css';

import FilterBuilder, {
    GroupOperationDescriptions
} from 'devextreme-react/filter-builder';

export default function App() {
    return (
        <FilterBuilder ... >
            <GroupOperationDescriptions
                and="Plus"
            />
        </FilterBuilder>
    );
}
See Also

groupOperations

Specifies a set of available group operations.

Type:

Array<String>

Default Value: ['and', 'or', 'notAnd', 'notOr']
Accepted Values: 'and' | 'or' | 'notAnd' | 'notOr'

The group operations are:

  • "and"
  • "notAnd"
    Returns a reverted result of an "and" operation: ["!", [[condition1], "and", [condition2]]].
  • "or"
  • "notOr"
    Returns a reverted result of an "or" operation: ["!", [[condition1], "or", [condition2]]].

View Demo

See Also

height

Specifies the UI component's height.

Type:

Number

|

String

|

Function

Return Value:

Number

|

String

The UI component's height.

Default Value: undefined

This property accepts a value of one of the following types:

  • Number
    The height in pixels.

  • String
    A CSS-accepted measurement of height. For example, "55px", "80%", "inherit".

  • Function
    A function returning either of the above. For example:

    JavaScript
    height: function() {
        return window.innerHeight / 1.5;
    }

hint

Specifies text for a hint that appears when a user pauses on the UI component.

Type:

String

Default Value: undefined

hoverStateEnabled

Specifies whether the UI component changes its state when a user pauses on it.

Type:

Boolean

Default Value: false

maxGroupLevel

Specifies groups' maximum nesting level.

Type:

Number

Default Value: undefined

Assign 0 to this property to disallow new groups, 1 - to allow new first-level groups, 2 - to allow new first- and second-level groups, and so on.

DevExtreme HTML5 JavaScript Filter Builder Group Nesting Levels

View Demo

onContentReady

A function that is executed when the UI component's content is ready and each time the content is changed.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

FilterBuilder

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

model any

Model data. Available only when using Knockout.

Default Value: null

onDisposing

A function that is executed before the UI component is disposed of.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

FilterBuilder

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

model any

Model data. Available only if you use Knockout.

Default Value: null

onEditorPrepared

A function that is executed after an editor is created.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

FilterBuilder

The UI component's instance.

dataField

String

The data field's name.

disabled

Boolean

Indicates whether the editor is disabled.

editorElement

HTMLElement | jQuery

The editor's container. It is an HTML Element or a jQuery Element when you use jQuery.

editorName

String

The editor's name.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

filterOperation

String

The applied filter operation.

model any

Model data. Available only if you use Knockout.

readOnly

Boolean

Indicates whether the editor is read-only.

rtlEnabled

Boolean

Indicates whether the editor uses right-to-left representation.

setValue(newValue) any

A method you need to call to change the field's value after the editor's value changes.

updateValueTimeout

Number

Gets and sets the delay between when a user stops typing the field's value and when it is applied.

value any

The editor's value.

width

Number

The editor's width.

Default Value: null

The UI component offers a user a different editor for entering a value depending on the field's dataType: Calendar, TextBox, SelectBox, etc. You can customize automatically created editors using this function.

NOTE
This function is not executed for fields that use the editorTemplate.

onEditorPreparing

A function that is executed before an editor is created.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
cancel

Boolean

Allows you to cancel the creation of the editor.
Set it to true and implement a custom editor.

component

FilterBuilder

The UI component's instance.

dataField

String

The data field's name.

disabled

Boolean

Indicates whether the editor is disabled.

editorElement

HTMLElement | jQuery

The editor's container. It is an HTML Element or a jQuery Element when you use jQuery.

editorName

String

Allows you to change the editor. Accepts names of DevExtreme UI components only, for example, "dxTextBox".
Import a new editor's module when DevExtreme modules are used.

editorOptions

Object

Gets and sets the editor configuration.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

filterOperation

String

The applied filter operation.

model any

Model data. Available only if you use Knockout.

readOnly

Boolean

Indicates whether the editor is read-only.

rtlEnabled

Boolean

Indicates whether the editor uses right-to-left representation.

setValue(newValue) any

A method you should call to change the field's value after the editor's value changes.

updateValueTimeout

Number

Gets and sets the delay between when a user stops typing the field value and when it is applied.

value any

The editor's value. This field is read-only. To change the editor's value, use the setValue(newValue, newText) function parameter.

width

Number

The editor's width.

Default Value: null

The UI component offers a user different editors for entering a value depending on the field's dataType: Calendar, TextBox, SelectBox, and so on. Use this function to customize those default editors or substitute them for other editors.

In the following code, a default editor is replaced with the DevExtreme TextArea UI component. Note that the UI component's onValueChanged function is overridden, and its declaration ends with the setValue(newValue, newText) method's call. This method updates the value.

jQuery
JavaScript
$(function() {
    $("#filterBuilder").dxFilterBuilder({
        // ...
        onEditorPreparing: function (e) {
            if (e.dataField == "description") {
                e.editorName = "dxTextArea"; 
                e.editorOptions.showClearButton = true;
                e.editorOptions.onValueChanged = function(event) {
                    const value = event.value;
                    e.setValue(value.toLowerCase()); 
                }
            }
        }
    });
});
Angular
TypeScript
HTML
import { DxFilterBuilderModule } from "devextreme-angular";
// ...
export class AppComponent {
    onEditorPreparing (e) { 
        if (e.dataField == "description") {
            e.editorName = "dxTextArea"; 
            e.editorOptions.showClearButton = true;
            e.editorOptions.onValueChanged = (event) => {
                const value = event.value;
                e.setValue(value.toLowerCase()); 
            }
        }
    }
}
@NgModule({
    imports: [
        // ...
        DxFilterBuilderModule
    ],
    // ...
})
<dx-filter-builder ...
    (onEditorPreparing)="onEditorPreparing($event)">
</dx-filter-builder>
Vue
App.vue
<template>
    <DxFilterBuilder ...
        @editor-preparing="onEditorPreparing">
    </DxFilterBuilder>
</template>

<script>
import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

import DxFilterBuilder from 'devextreme-vue/filter-builder';

export default {
    components: {
        DxFilterBuilder
    },
    // ...
    methods: {
        onEditorPreparing (e) { 
            if (e.dataField == "description") {
                e.editorName = "dxTextArea"; 
                e.editorOptions.showClearButton = true;
                e.editorOptions.onValueChanged = (event) => {
                    const value = event.value;
                    e.setValue(value.toLowerCase()); 
                }
            }
        }
    }
}
</script>
React
App.js
import React from 'react';

import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

import FilterBuilder from 'devextreme-react/filter-builder';

class App extends React.Component {
    onEditorPreparing (e) { 
        if (e.dataField == "description") {
            e.editorName = "dxTextArea"; 
            e.editorOptions.showClearButton = true;
            e.editorOptions.onValueChanged = (event) => {
                const value = event.value;
                e.setValue(value.toLowerCase()); 
            }
        }
    }
    render() {
        return (
            <FilterBuilder ...
                onEditorPreparing={this.onEditorPreparing}>
            </FilterBuilder>
        );
    }
}
export default App;
NOTE
This function is not executed for fields that use the editorTemplate.

onInitialized

A function used in JavaScript frameworks to save the UI component instance.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

FilterBuilder

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

Default Value: null

See Also

onOptionChanged

A function that is executed after a UI component property is changed.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
model any

Model data. Available only if you use Knockout.

fullName

String

The path to the modified property that includes all parent properties.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

component

FilterBuilder

The UI component's instance.

name

String

The modified property if it belongs to the first level. Otherwise, the first-level property it is nested into.

value any

The modified property's new value.

Default Value: null

The following example shows how to subscribe to component property changes:

jQuery
index.js
$(function() {
    $("#filterBuilderContainer").dxFilterBuilder({
        // ...
        onOptionChanged: function(e) {
            if(e.name === "changedProperty") {
                // handle the property change here
            }
        }
    });
});
Angular
app.component.html
app.component.ts
app.module.ts
<dx-filter-builder ...
    (onOptionChanged)="handlePropertyChange($event)"> 
</dx-filter-builder>
import { Component } from '@angular/core'; 

@Component({ 
    selector: 'app-root', 
    templateUrl: './app.component.html', 
    styleUrls: ['./app.component.css'] 
}) 

export class AppComponent { 
    // ...
    handlePropertyChange(e) {
        if(e.name === "changedProperty") { 
            // handle the property change here
        }
    }
}
import { BrowserModule } from '@angular/platform-browser'; 
import { NgModule } from '@angular/core'; 
import { AppComponent } from './app.component'; 
import { DxFilterBuilderModule } from 'devextreme-angular'; 

@NgModule({ 
    declarations: [ 
        AppComponent 
    ], 
    imports: [ 
        BrowserModule, 
        DxFilterBuilderModule 
    ], 
    providers: [ ], 
    bootstrap: [AppComponent] 
}) 

export class AppModule { }  
Vue
App.vue
<template> 
    <DxFilterBuilder ...
        @option-changed="handlePropertyChange"
    />            
</template> 

<script>  
import 'devextreme/dist/css/dx.light.css'; 
import DxFilterBuilder from 'devextreme-vue/filter-builder'; 

export default { 
    components: { 
        DxFilterBuilder
    }, 
    // ...
    methods: { 
        handlePropertyChange: function(e) {
            if(e.name === "changedProperty") {
                // handle the property change here
            }
        }
    } 
} 
</script> 
React
App.js
import React from 'react';  
import 'devextreme/dist/css/dx.light.css'; 

import FilterBuilder from 'devextreme-react/filter-builder'; 

const handlePropertyChange = (e) => {
    if(e.name === "changedProperty") {
        // handle the property change here
    }
}

export default function App() { 
    return ( 
        <FilterBuilder ...
            onOptionChanged={handlePropertyChange}
        />        
    ); 
} 

onValueChanged

A function that is executed after the UI component's value is changed.

Type:

Function

Function parameters:
e:

Object

Information about the event.

Object structure:
Name Type Description
component

FilterBuilder

The UI component's instance.

element

HTMLElement | jQuery

The UI component's container. It is an HTML Element or a jQuery Element when you use jQuery.

model any

Model data. Available only if you use Knockout.

previousValue

Object

The UI component's previous value.

value

Object

The UI component's new value.

Default Value: null

rtlEnabled

Switches the UI component to a right-to-left representation.

Type:

Boolean

Default Value: false

When this property is set to true, the UI component text flows from right to left, and the layout of elements is reversed. To switch the entire application/site to the right-to-left representation, assign true to the rtlEnabled field of the object passed to the DevExpress.config(config) method.

JavaScript
DevExpress.config({
    rtlEnabled: true
});

DataGrid Demo Navigation UI Demo Editors Demo

tabIndex

Specifies the number of the element when the Tab key is used for navigating.

Type:

Number

Default Value: 0

The value of this property will be passed to the tabindex attribute of the HTML element that underlies the UI component.

value

Allows you to specify a filter.

Default Value: null
Raised Events: onValueChanged

NOTE
This property may contain filter operations that the DataSource does not support. Use the getFilterExpression method to get the DataSource-compatible filter expression.
See Also

visible

Specifies whether the UI component is visible.

Type:

Boolean

Default Value: true

width

Specifies the UI component's width.

Type:

Number

|

String

|

Function

Return Value:

Number

|

String

The UI component's width.

Default Value: undefined

This property accepts a value of one of the following types:

  • Number
    The width in pixels.

  • String
    A CSS-accepted measurement of width. For example, "55px", "80%", "auto", "inherit".

  • Function
    A function returning either of the above. For example:

    JavaScript
    width: function() {
        return window.innerWidth / 1.5;
    }