QueryBuilder Blazor API

QueryBuilder Properties

NameTypeDefaultDescription
AllowDragboolfalseAllows users to drag and reorder conditions within a single group or move conditions between different groups, facilitating flexible arrangement and organization of conditions through a user-friendly drag-and-drop interface.
ApplyModeQueryBuilderApplyModeQueryBuilderApplyMode.ChangeControls the timing of when the element’s value is updated in response to changes, such as user input or interactions. This setting specifies whether the value updates immediately as the user types, when the input loses focus, or upon a specific event.
AutoApplyValueboolfalseWhen 'applyMode' is set to 'immediately', the default value is instantly assigned to the editor's value, and the QueryBuilder's value is updated in real-time without requiring any additional user action. This ensures that changes are automatically reflected as soon as the default value is set.
AutoPromptboolfalseControls whether the QueryBuilder component will automatically display a prompt asking the user to enter a value when a new condition is added. If 'applyMode' is set to 'immediately', and the operation field of a newly created condition is empty, QueryBuilder will automatically populate the operation field when the user selects or changes the condition operator. Additionally, whenever the operation or operator of an existing condition is changed, the input field will prompt the user to enter a new value relevant to the updated condition. This ensures that condition values are collected promptly and accurately as users modify or add filtering criteria.
CustomOperationsIEnumerable<IQueryBuilderCustomOperation>N/AEnhances the query builder’s condition structure by allowing additional custom operations. Each custom operation can be defined with the following fields:
DisabledboolfalseSpecifies whether the element is interactive and can receive user input. When enabled, the element functions normally. When disabled, the element becomes non-interactive and typically appears visually distinct (e.g., grayed out), preventing user actions such as clicks or text entry.
DropDownWidthstring"100%"Configures or retrieves the width (in pixels) of the dropdown menus used in both the property and operator editors, allowing for precise control over their display size in the user interface.
FieldsIEnumerable<IQueryBuilderField>N/A''

An array defining the filterable fields and their corresponding configuration options to control their behavior and appearance. Each field in the array is represented as an object and can be customized using the following properties:

- 'label':
The human-readable name for the field. This label will be displayed in the filter field selection dropdown.

- 'dataField':
The key or property name in your data source that corresponds to this field.

- 'dataType':
Specifies the type of data contained in the field, such as ''string'', ''number'', ''date'', etc. This setting can affect which filter operations are available.

- 'filterOperations':
An array specifying which filter operations (such as ''contains'', ''equals'', ''greaterThan'', etc.) can be applied to this field. If this property is omitted, a default set of operations appropriate to the data type will be used.

- 'lookup':
An object for configuring the value selection input when filtering this field. The 'lookup' object supports the following options:

- 'autoCompleteDelay':
The delay, in milliseconds, between when the user types in the value selection input and when the dropdown with available options appears.

- 'dataSource':
An array containing the set of predefined options that the user can choose from in the dropdown.

- 'minLength':
The minimum number of characters the user must enter in the input before the options dropdown is shown.

- 'readonly':
Set to 'true' to make the value selection input act as a standard dropdown (the user can only select from the list); set to 'false' for a combo box (the user can type custom values in addition to choosing from the list).

This structure provides developers with fine-grained control over how each filter field appears and operates, including the available filter types and the way users select or enter filter values.
FieldsModeQueryBuilderFieldsModeQueryBuilderFieldsMode.DynamicControls whether users are allowed to create and add new fields by typing directly into the field (property) input box, enabling dynamic extension of available fields beyond the predefined options.
FormatStringDatestring"dd-MMM-yy"Specifies or retrieves the format string used by the editor for fields of type 'date'. This determines how date values are displayed and parsed within the editor. Adjusting this string allows customization of the date format according to localization or application requirements.
FormatStringDateTimestring"dd-MMM-yy HH:mm:ss"Gets or sets the format string used by the editor for fields of type 'dateTime'. This format string determines how date and time values are displayed and parsed within the editor.
GetDynamicFieldobjectN/AA callback function that is invoked whenever a new field is dynamically added. This function allows you to configure or modify the settings of the newly added field before it is rendered. This callback is only applicable when fieldsMode is set to 'dynamic'.
Iconsobject{ '=': 'equals', '<>': 'notequals', '>': 'greaterthan', '>=': 'greaterthanorequal', '<': 'lessthan', '<=': 'lessthanorequal', 'startswith': 'startswith', 'endswith': 'endswith', 'contains': 'contains', 'notcontains': 'notcontains', 'isblank': 'isblank', 'isnotblank': 'isnotblank' }Specifies the CSS classes assigned to each built-in operation, which determine the corresponding icons displayed for those operations. The icon styles are defined in the Smart-query-builder stylesheet. This property takes effect only when showIcons is set to true, enabling visual representation of operations with their respective icons.
UnlockKeystring""Provides methods to set or retrieve the 'unlockKey', a unique key required to unlock access to the product. Use this property to assign an unlock key for product activation or to obtain the currently assigned unlock key.
Localestring"en"Specifies or retrieves the current language code (e.g., "en", "fr", "es"). This property determines which set of messages from the messages object will be used for display or processing. Setting this property updates the active language, while getting it returns the currently selected language.
MessagesobjectN/ASpecifies the names of the fields to be included in the filtered element, allowing you to control which data properties are retained or displayed after filtering.
OperatorPlaceholderstring"Operator"Specifies the placeholder text that appears within the operator selection box when no operator has been chosen for the condition. This text guides users by indicating that they need to select an operator.
PropertyPlaceholderstring"Property"Specifies the placeholder text displayed within the condition's property field when no field is currently selected by the user. This text provides guidance or prompts users to select a field.
RightToLeftboolfalseConfigures or retrieves the value that determines whether the element’s alignment supports right-to-left (RTL) text direction, which is typically used for languages such as Arabic or Hebrew. This property controls whether the element’s layout and text flow are adjusted to accommodate RTL locales.
ShowIconsboolfalseControls the visibility of operator icons within the operator selection dropdown menu. When enabled, icons representing each operator are displayed alongside their names in the dropdown list; when disabled, only the operator names are shown without icons.
ShowFieldNameArrowboolfalseControls the visibility of the dropdown icon associated with the operator field in the conditions section. When enabled, the dropdown icon appears next to the operator field name, allowing users to select an operator from the available options. When disabled, the dropdown icon is hidden, preventing users from opening the operator selection menu.
Themestring""Specifies the theme to be applied to the element. The theme controls the overall appearance, including colors, fonts, and styling, to ensure a consistent visual presentation throughout the interface.
UnfocusableboolfalseIf set to true, this property prevents the element from receiving keyboard or programmatic focus, making it unable to become the active element within the user interface.
ValidateOnInputboolfalseSpecifies whether the condition's value should be validated in real-time as the user types (on every key up event) or only when the input field loses focus (on blur), which is the default behavior. If enabled, value validation occurs after the user stops typing, following a delay defined by the validationTimeout property, which sets the time interval (in milliseconds) before triggering validation after typing ceases.
ValidationTimeoutint100Specifies the delay (in milliseconds) that begins once the user has stopped typing in the value field, after which the condition value is validated. This property works in conjunction with validationOnInput, controlling how soon validation is triggered after user input is complete.
ValueobjectN/AThe value is structured as a multidimensional array, where each top-level element represents a group operator (such as AND or OR) that organizes multiple conditions. Within each group, an array of condition objects specifies the individual filtering criteria. This structure allows for the representation of complex, nested logical expressions by combining multiple groups and conditions.
ValueFormatFunctionobjectN/AA callback function that formats the display or value of the condition input fields before they are rendered or processed. Use this to customize how condition values appear to users or are handled within the application.
ValuePlaceholderstring"Value"Specifies the placeholder text displayed within the condition's value input field when no value has been entered. This text provides guidance or hints to the user about the expected input.

QueryBuilder Methods

NameTypeArgumentsDescription
GetLinqstringN/ATransforms the element's current value into a valid Dynamic LINQ expression, enabling advanced querying and runtime evaluation based on the element's data.
GetValueAsync()Task<object>'N/A'Gets the &quot;Value&quot; property as Task&lt;object&gt;.
Refreshvoid'N/A'Refreshes the Blazor Component. Performs a layout of the HTML Elements and recalculates the measurements.
Rendervoid'N/A'Re-renders the Blazor Component. This method will make a full re-render.
StateHasChangedvoid'N/A'Refreshes the state and Re-renders the Blazor Component, if necessary.

QueryBuilder Events

NameTypeDescriptionEvent Detail
OnChangeEventCallback<Event>This event is triggered whenever the value within the query builder is modified by the user, such as adding, editing, or removing rules or conditions. It provides an opportunity to respond to changes in the query configuration, such as validating input, updating results, or synchronizing state with other components.dynamic item- The item that is being dragged., dynamic data- The data of the item that is being dragged., dynamic originalEvent- The original event.
Changedevent QueryBuilderChangedEventHandlerThis event is triggered whenever the value within the query builder is modified by the user, such as adding, editing, or removing rules or conditions. It provides an opportunity to respond to changes in the query configuration, such as validating input, updating results, or synchronizing state with other components.QueryBuilderChangedEventArgs
OnDragEndEventCallback<Event>This event is triggered when a condition that is being dragged is dropped onto a valid target area within the interface. You can prevent the drop action from completing by calling event.preventDefault() within the event handler function. This allows you to implement custom validation or restrict drops based on specific criteria before the condition is accepted.dynamic item- The item that is being dragged., dynamic data- The data of the item that is being dragged., dynamic target- The target item., dynamic targetData- the data of the target item., string targetSide- The side of the target item where the dragged item will be dropped.
DragEndedevent QueryBuilderDragEndedEventHandlerThis event is triggered when a condition that is being dragged is dropped onto a valid target area within the interface. You can prevent the drop action from completing by calling event.preventDefault() within the event handler function. This allows you to implement custom validation or restrict drops based on specific criteria before the condition is accepted.QueryBuilderDragEndedEventArgs
OnDraggingEventCallback<Event>This event is triggered whenever a condition element is actively being dragged within the user interface. It fires continuously throughout the dragging process, allowing developers to track the position and state of the condition as it moves, and to implement custom behaviors—such as visual feedback or dynamic updates—while the drag action is in progress.dynamic item- The item that is being dragged., dynamic data- The data of the item that is being dragged., dynamic originalEvent- The original event.
Draggingevent QueryBuilderDraggingEventHandlerThis event is triggered whenever a condition element is actively being dragged within the user interface. It fires continuously throughout the dragging process, allowing developers to track the position and state of the condition as it moves, and to implement custom behaviors—such as visual feedback or dynamic updates—while the drag action is in progress.QueryBuilderDraggingEventArgs
OnDragStartEventCallback<Event>This event fires when a drag operation begins within the jqx-query-builder component. You can intercept and prevent the drag action from proceeding by calling event.preventDefault() within your event handler. This allows you to implement custom logic or restrictions before the drag operation officially starts.dynamic item- The item is going to be dragged., dynamic data- The data of the item that is going to be dragged., dynamic originalEvent- The original event.
DragStartedevent QueryBuilderDragStartedEventHandlerThis event fires when a drag operation begins within the jqx-query-builder component. You can intercept and prevent the drag action from proceeding by calling event.preventDefault() within your event handler. This allows you to implement custom logic or restrictions before the drag operation officially starts.QueryBuilderDragStartedEventArgs
OnItemClickEventCallback<Event>This event is triggered whenever a user interacts with any component of the query builder—such as selecting an operator, clicking on a field name, entering a value, or pressing the close button. It allows you to respond to user actions on any of the query builder’s building blocks.string id- The internal id of the clicked item, e.g. '0.1', '1.1', etc., dynamic type- The type of the clicked item ( condition or a group )., dynamic data- The data of the item.
ItemClickedevent QueryBuilderItemClickedEventHandlerThis event is triggered whenever a user interacts with any component of the query builder—such as selecting an operator, clicking on a field name, entering a value, or pressing the close button. It allows you to respond to user actions on any of the query builder’s building blocks.QueryBuilderItemClickedEventArgs
OnPropertySelectedEventCallback<Event>This event is triggered when a user selects a specific field, indicating that the field has become active or has received focus. It can be used to initiate actions such as loading related data, displaying contextual hints, or tracking user interactions with the form element.string label- The label of the selected property., dynamic value- The value of the selected property.
PropertySelectedevent QueryBuilderPropertySelectedEventHandlerThis event is triggered when a user selects a specific field, indicating that the field has become active or has received focus. It can be used to initiate actions such as loading related data, displaying contextual hints, or tracking user interactions with the form element.QueryBuilderPropertySelectedEventArgs
OnValidationChangeEventCallback<Event>This event is triggered whenever the component performs input validation. Validation occurs each time a user enters a new value and then shifts focus away from the component (for example, by clicking or tabbing to another UI element). The event provides an opportunity to respond to changes in the input’s validity, such as displaying error messages or updating related state.dynamic oldValue- Old validation status., dynamic newValue- New validation status.
ValidationChangedevent QueryBuilderValidationChangedEventHandlerThis event is triggered whenever the component performs input validation. Validation occurs each time a user enters a new value and then shifts focus away from the component (for example, by clicking or tabbing to another UI element). The event provides an opportunity to respond to changes in the input’s validity, such as displaying error messages or updating related state.QueryBuilderValidationChangedEventArgs

Enums

QueryBuilderApplyMode

QueryBuilderApplyMode.Change
QueryBuilderApplyMode.Immediately

QueryBuilderFieldsMode

QueryBuilderFieldsMode.Dynamic
QueryBuilderFieldsMode.Static

QueryBuilderCustomOperation Properties

NameTypeDefaultDescription
Labelstring""label to be displayed in the operator box. Multiple operations with the same label can exist
Namestring""A unique name for the operation.
EditorTemplateobjectnullA callback function that creates a custom value editor. Takes three arguemnts:
  • fieldType - the type of the field for the operation.
  • value - the value of the condition.
  • fieldData - the field object.
ValueTemplateobjectnullA callback function that displays the value after the edior has been closed. Takes two argument:
  • editor - the custom editor element
  • value - the condition value.
HandleValueobjectnullA callback function that handles the value returned by the editor when it is closed. The callback takes one arguemnt - the custom editor element. If the dataType is 'object' the expected result from the function should contain a 'label' and 'value' attributes. Where the label will be used for displaying purposes while 'value' will be used as the actual value.
HideValueboolfalseA boolean condition that specifies whether the operation requires a value or not.
ValidateValueobjectnullA callback that is executed when QueryBuilder validation is triggered. The callback takes one argument, the value of the condition. The function should return true or false to determine whether the conditon is valid or not.
OnEditorOpenobjectnullA callback that is called when the custom editor is rendered, visible inside the DOM and ready to be opened. The callback has one parameter - the custom editor element.
ExpressionTemplatestring""A string representing a custom Linq expression template. If the value of the element is a string it will be considered as a Linq expression and it will be checked against all expressionTemplates to find a match.
ExpressionReaderCallbackobjectnullA callback that is used to specify which arguments from the expression are used for the fieldName and value. Used when converting a Linq expression to QueryBuilder value. Takes two arguments:
  • expression - the LinQ expression defined in the expressionTemplate of the customOperator. Type string
  • bindings - an array of expression parameters based on the expression template of the customOperator. Type string[]
ExpressionBuilderCallbackobjectnullA callback function that is used to specify which arguments from the Linq expression are used for the fieldName and value when building the Linq expression from the current value of the element. Takes three arguments:
  • name - the name of the dataField. Type string.
  • operation - the name of the operation. Type string
  • value - the value of the operation. Type any( depends on the dataField).

QueryBuilderField Properties

NameTypeDefaultDescription
Labelstring""Sets or gets the label.
DataFieldstring""Sets or gets the data field
DataTypestring"string"Sets or gets the data type.
Formatstring""Sets or gets the filter format.
FilterOperationsstring[]new string[]{}Sets or gets the filter operations.