JavaScript/jQuery FilterBuilder Options
See Also
- Configure a Widget: Angular | Vue | React | jQuery | AngularJS | Knockout | ASP.NET MVC 5 | ASP.NET Core
accessKey
The value of this option will be passed to the accesskey
attribute of the HTML element that underlies the widget.
elementAttr
Specifies the attributes to be attached to the widget's root element.
jQuery
$(function(){ $("#filterBuilderContainer").dxFilterBuilder({ // ... elementAttr: { id: "elementId", class: "class-name" } }); });
Angular
<dx-filter-builder ... [elementAttr]="{ id: 'elementId', class: 'class-name' }"> </dx-filter-builder>
import { DxFilterBuilderModule } from "devextreme-angular"; // ... export class AppComponent { // ... } @NgModule({ imports: [ // ... DxFilterBuilderModule ], // ... })
ASP.NET MVC Controls
@(Html.DevExtreme().FilterBuilder() .ElementAttr("class", "class-name") // ===== or ===== .ElementAttr(new { @id = "elementId", @class = "class-name" }) // ===== or ===== .ElementAttr(new Dictionary<string, object>() { { "id", "elementId" }, { "class", "class-name" } }) )
@(Html.DevExtreme().FilterBuilder() _ .ElementAttr("class", "class-name") ' ===== or ===== .ElementAttr(New With { .id = "elementId", .class = "class-name" }) ' ===== or ===== .ElementAttr(New Dictionary(Of String, Object) From { { "id", "elementId" }, { "class", "class-name" } }) )
fields
This option 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.
See the Field section for details on fields you can specify in each object.
groupOperations
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]]]
.
See Also
height
This option 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:JavaScriptheight: function() { return window.innerHeight / 1.5; }
maxGroupLevel
Assign 0 to this option to disallow new groups, 1 - to allow new first-level groups, 2 - to allow new first- and second-level groups, and so on.
onContentReady
A function that is executed when the widget's content is ready and each time the content is changed.
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only when using Knockout. |
onDisposing
A function that is executed before the widget is disposed of.
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if you use Knockout. |
onEditorPrepared
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
dataField |
The data field's name. |
|
disabled |
Indicates whether the editor is disabled. |
|
editorElement |
The editor's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
editorName |
The editor's name. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
filterOperation |
The applied filter operation. |
|
model |
The model data. Available only if you use Knockout. |
|
readOnly |
Indicates whether the editor is read-only. |
|
rtlEnabled |
Indicates whether the editor uses right-to-left representation. |
|
setValue(newValue) | any |
A method that you need to call to change the field's value after the editor's value changes. |
updateValueTimeout |
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 |
The editor's width. |
The widget 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.
onEditorPreparing
Name | Type | Description |
---|---|---|
cancel |
Allows you to cancel the creation of the editor. |
|
component |
The widget's instance. |
|
dataField |
The data field's name. |
|
disabled |
Indicates whether the editor is disabled. |
|
editorElement |
The editor's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
editorName |
Allows you to change the editor. Accepts names of DevExtreme widgets only, for example, "dxTextBox". |
|
editorOptions |
Gets and sets the editor configuration. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
filterOperation |
The applied filter operation. |
|
model |
The model data. Available only if you use Knockout. |
|
readOnly |
Indicates whether the editor is read-only. |
|
rtlEnabled |
Indicates whether the editor uses right-to-left representation. |
|
setValue(newValue) | any |
A method that you should call to change the field's value after the editor's value changes. |
updateValueTimeout |
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. |
width |
The editor's width. |
The widget 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 widget. Note that the widget's onValueChanged function is overridden, and its declaration ends with the setValue(newValue, newText) method's call. This method updates the value.
jQuery
$(function() { $("#filterBuilder").dxFilterBuilder({ // ... onEditorPreparing: function (e) { if (e.dataField == "description") { e.editorName = "dxTextArea"; e.editorOptions.showClearButton = true; e.editorOptions.onValueChanged = function(event) { var value = event.value; e.setValue(value.toLowerCase()); } } } }); });
Angular
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) => { let value = event.value; e.setValue(value.toLowerCase()); } } } } @NgModule({ imports: [ // ... DxFilterBuilderModule ], // ... })
<dx-filter-builder ... (onEditorPreparing)="onEditorPreparing($event)"> </dx-filter-builder>
The following code shows how to replace a default editor with a non-DevExtreme editor (an HTML checkbox in this case):
jQuery
$(function() { $("#filterBuilder").dxFilterBuilder({ // ... onEditorPreparing: function(e) { if(e.dataField === "completed") { e.cancel = true; // Cancels creating the default editor $('<input type="checkbox">') .prop("checked", e.value) .on("change", function(event) { e.setValue(event.target.checked); }) .appendTo(e.editorElement); } } }); });
Angular
import { DxFilterBuilderModule } from "devextreme-angular"; // ... export class AppComponent { onEditorPreparing (e) { if(e.dataField === "completed") { e.cancel = true; // Cancels creating the default editor let checkbox = document.createElement("INPUT"); checkbox.setAttribute("type", "checkbox"); checkbox.setAttribute("checked", e.value); checkbox.addEventListener("change", (event) => { e.setValue(event.target.checked); }); e.editorElement.appendChild(checkbox); } } } @NgModule({ imports: [ // ... DxFilterBuilderModule ], // ... })
<dx-filter-builder ... (onEditorPreparing)="onEditorPreparing($event)"> </dx-filter-builder>
onInitialized
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
onOptionChanged
Name | Type | Description |
---|---|---|
model |
The model data. Available only if you use Knockout. |
|
fullName |
The path to the modified option that includes all parent options. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
component |
The widget's instance. |
|
name |
The modified option if it belongs to the first level. Otherwise, the first-level option it is nested into. |
|
value | any |
The modified option's new value. |
onValueChanged
A function that is executed after the widget's value is changed.
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if you use Knockout. |
|
previousValue |
The widget's previous value. |
|
value |
The widget's new value. |
rtlEnabled
When this option is set to true, the widget 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.
DevExpress.config({ rtlEnabled: true });
See Also
- Right-to-Left Support Demo: DataGrid | Navigation Widgets | Editors
tabIndex
The value of this option will be passed to the tabindex
attribute of the HTML element that underlies the widget.
value
See Also
width
This option 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:JavaScriptwidth: function() { return window.innerWidth / 1.5; }
If you have technical questions, please create a support ticket in the DevExpress Support Center.