Class QueryBuilderColumn
Represents a single column definition within the Syncfusion Blazor Syncfusion.Blazor.QueryBuilder component.
Inherited Members
Namespace: Syncfusion.Blazor.QueryBuilder
Assembly: Syncfusion.Blazor.dll
Syntax
public class QueryBuilderColumn : SfDataBoundComponent
Remarks
The QueryBuilderColumn allows you to define properties for each column, such as its data type, display label, format, and custom templates. These columns are then used to construct rules and conditions in the Query Builder.
Examples
The following example demonstrates how to define columns in a Syncfusion.Blazor.QueryBuilder.
<SfQueryBuilder>
<QueryBuilderColumns>
<QueryBuilderColumn Field="EmployeeID" Label="Employee ID" Type="ColumnType.Number"></QueryBuilderColumn>
<QueryBuilderColumn Field="FirstName" Label="First Name" Type="ColumnType.String"></QueryBuilderColumn>
</QueryBuilderColumns>
</SfQueryBuilder>
Constructors
QueryBuilderColumn()
Declaration
public QueryBuilderColumn()
Properties
Category
Gets or sets the category for the column, which helps in grouping columns in the UI.
Declaration
public string Category { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string that specifies the category name. The default value is "OtherFields". |
Remarks
Columns with the same category will be grouped together in the field selection dropdown, improving usability.
ChildContent
Gets or sets the child content for the column, which can include additional configuration components such as QueryBuilderColumnValidation.
Declaration
public RenderFragment ChildContent { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.RenderFragment | A Microsoft.AspNetCore.Components.RenderFragment representing the child content. The default value is |
Remarks
This property is used to define nested components that provide additional configuration for the column.
ColumnTemplate
Gets or sets a template for rendering the entire column header.
Declaration
public RenderFragment<RuleModel> ColumnTemplate { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.RenderFragment<RuleModel> | A Microsoft.AspNetCore.Components.RenderFragment<> that defines the template for the column. The default value is |
Remarks
This template can be used to customize the appearance of the column in the UI. The context of the template is a RuleModel.
Field
Gets or sets the data field name that this column is bound to.
Declaration
public string Field { get; set; }
Property Value
Type | Description |
---|---|
System.String | A |
Remarks
This property is mandatory and must match a field in the data source for the Query Builder to function correctly.
Format
Gets or sets the display format for date and number type columns.
Declaration
public string Format { get; set; }
Property Value
Type | Description |
---|---|
System.String | A |
Remarks
For date columns, you can use standard date format strings (e.g., "d", "M"). For numeric columns, you can use standard numeric format strings (e.g., "n2", "c").
Label
Gets or sets the display text for the column in the UI.
Declaration
public string Label { get; set; }
Property Value
Type | Description |
---|---|
System.String | A |
Remarks
This property provides a user-friendly name for the column in the Query Builder interface.
Operators
Gets or sets the list of custom operators for the column.
Declaration
public List<OperatorsModel> Operators { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<OperatorsModel> | A list of OperatorsModel that define the custom operators. The default value is |
Remarks
If this property is not set, the Query Builder will use the default operators based on the column's Type.
Step
Gets or sets the step value for numeric columns, used in controls like a numeric textbox.
Declaration
public int Step { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | An |
Remarks
Type
Gets or sets the data type of the column.
Declaration
public ColumnType Type { get; set; }
Property Value
Type | Description |
---|---|
ColumnType | A ColumnType enum value. |
Remarks
The data type determines the default set of operators and the appropriate input control for the column's value.
Value
Gets or sets the default value for the column's input field.
Declaration
public dynamic Value { get; set; }
Property Value
Type | Description |
---|---|
System.Object | A dynamic type that can hold various data types such as |
Remarks
This value is used to pre-populate the input field when a new rule is created for this column.
Values
Gets or sets a list of predefined values for the column's input field, typically used for dropdowns.
Declaration
public dynamic Values { get; set; }
Property Value
Type | Description |
---|---|
System.Object | A dynamic type that usually holds a collection of items (e.g., |
Remarks
This is useful when you want to restrict the user to select from a predefined list of options, which will be rendered as a dropdown list.
ValueTemplate
Gets or sets the template for rendering the value input field.
Declaration
public RenderFragment<RuleModel> ValueTemplate { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.RenderFragment<RuleModel> | A Microsoft.AspNetCore.Components.RenderFragment<> that defines the template for the value input. The default value is |
Remarks
This allows you to use custom components, such as a slider or a masked textbox, for entering rule values. The context of the template is a RuleModel.
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
OnInitializedAsync()
Method invoked when the component is ready to start.
Declaration
protected override Task OnInitializedAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous initialization process. |
Overrides
Remarks
This method initializes the component's state and updates the parent with its properties.
OnParametersSetAsync()
Method invoked when the component has received parameters from its parent.
Declaration
protected override Task OnParametersSetAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents the asynchronous operation. |
Overrides
Remarks
This method detects changes in component properties and notifies the parent Syncfusion.Blazor.QueryBuilder to re-render if necessary.