QueryBuilder Blazor API

QueryBuilder Properties

NameTypeDefaultDescription
AllowDragboolfalseEnables the dragging of conditions inside a group or between groups.
ApplyModeQueryBuilderApplyModeQueryBuilderApplyMode.ChangeDetermines when the value of the element is updated with the new changes.
AutoPromptboolfalseDetermines whether QueryBuilder will automatically prompt the user to enter a condition value when a new condition is created. When 'applyMode' is set to 'immediately', the operation field is automatically populated if empty when the selected condition operator is changed. The input field prompts the user when the operation or operator of the condition is changed.
CustomOperationsIEnumerable<IQueryBuilderCustomOperation>N/AAdds more operations that can be used to the query bilder's conditions structure. Each custom operation can have the following fields:
DisabledboolfalseEnables or disables the element.
DropDownWidthstring"100%"Sets or gets the dropdown width of the property and operator editors.
FieldsIEnumerable<IQueryBuilderField>N/AArray with filter fields and their settings. The available field settings are:
  • label - the field's label, as it will appear in the field selection drop down
  • dataField - the field's data field
  • dataType - the field's data type
  • filterOperations - an array of the filter operations applicable to the field; if not set, the default filter operations are applied
  • lookup - an object with settings for customizing the field's respective value selection input. It has the following settings:
    • autoCompleteDelay - delay between typing in the input and opening the drop down with available options
    • dataSource - an array of available options to choose from (appear in a drop down)
    • minLength - minimum number of charactes to type in the input before the options drop down is displayed
    • readonly - if set to true, the value selection input acts as a drop down list, otherwise it acts as a combo box
FieldsModeQueryBuilderFieldsModeQueryBuilderFieldsMode.DynamicDetermines whether new fields can be dynamically added by typing in the field (property) box.
FormatStringDatestring"dd-MMM-yy"Sets or gets the format string of the editor of fields with type 'date'.
FormatStringDateTimestring"dd-MMM-yy HH:mm:ss"Sets or gets the format string of the editor of fields with type 'dateTime'.
GetDynamicFieldobjectN/AA callback function called when a field is added dynamically. Used for configuring settings of the new field. Applicable only when fieldsMode is 'dynamic'.
Iconsobject{ '=': 'equals', '<>': 'notequals', '>': 'greaterthan', '>=': 'greaterthanorequal', '<': 'lessthan', '<=': 'lessthanorequal', 'startswith': 'startswith', 'endswith': 'endswith', 'contains': 'contains', 'notcontains': 'notcontains', 'isblank': 'isblank', 'isnotblank': 'isnotblank' }Defines CSS classes to be applied to each of the built-in operations. Icons for these classes are applied in the Smart-query-builder style sheet. This property is applicable only if showIcons is set to true.
Localestring"en"Sets or gets the language. Used in conjunction with the property messages.
MessagesobjectN/ADefines field names of the filtered element.
OperatorPlaceholderstring"Operator"Determines the placeholder text used inside the condition's operator box in case an operator is not selected.
PropertyPlaceholderstring"Property"Determines the placeholder text used inside the condition's field (property) box in case a field is not selected.
RightToLeftboolfalseSets or gets the value indicating whether the element is aligned to support locales using right-to-left fonts.
ShowIconsboolfalseShows/Hides the operator icons shown in the operator selection drop down.
ShowFieldNameArrowboolfalseShows/Hides the drop down icon for the operator field name of the conditions.
Themestring""Determines the theme. Theme defines the look of the element
UnfocusableboolfalseIf is set to true, the element cannot be focused.
ValidateOnInputboolfalseDetermines whether the value of the condition is validated on key up or not. By default the value is validated when the user blur's the value input. The validationTimeout determines the time interval after the user has ended typing that triggers the value validation.
ValidationTimeoutint100Determines the timeout (starting after the user has finished typing in the value field) before the validation is applied to the condition value. This property works along validationOnInput.
ValueobjectN/AThe value is represented by multidimensional array. The array contains group operators with conditions. Each group can contain multiple conditions.
ValueFormatFunctionobjectN/ACallback used to format the content of the condition value fields.
ValuePlaceholderstring"Value"Determines the placeholder text used inside the condition's value box in case a value is not set.

QueryBuilder Methods

NameTypeArgumentsDescription
GetLinqstringN/AConverts the current value of the element to DynamicLINQ expression.
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 when the query builder's value is changed.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 when the query builder's value is changed.QueryBuilderChangedEventArgs
OnDragEndEventCallback<Event>This event is triggered when a dragged condition is dropped. This action can be canceled by calling event.preventDefault() in the event handler function.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 dragged condition is dropped. This action can be canceled by calling event.preventDefault() in the event handler function.QueryBuilderDragEndedEventArgs
OnDraggingEventCallback<Event>This event is triggered when a condition is being dragged.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 when a condition is being dragged.QueryBuilderDraggingEventArgs
OnDragStartEventCallback<Event>This event is triggered when a dragging operation is started in jqx-query-builder. This action can be canceled by calling event.preventDefault() in the event handler function.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 is triggered when a dragging operation is started in jqx-query-builder. This action can be canceled by calling event.preventDefault() in the event handler function.QueryBuilderDragStartedEventArgs
OnItemClickEventCallback<Event>This event is triggered when one of the query builder's building blocks ( oeprator, fieldName, value, close button, etc) is clicked.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 when one of the query builder's building blocks ( oeprator, fieldName, value, close button, etc) is clicked.QueryBuilderItemClickedEventArgs
OnPropertySelectedEventCallback<Event>This event is triggered when a field has been selected.string label- The label of the selected property., dynamic value- The value of the selected property.
PropertySelectedevent QueryBuilderPropertySelectedEventHandlerThis event is triggered when a field has been selected.QueryBuilderPropertySelectedEventArgs

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.