menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class QueryBuilderTemplates - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class QueryBuilderTemplates

    Specifies the template settings for the SfQueryBuilder<TValue> columns.

    Inheritance
    System.Object
    QueryBuilderTemplates
    Namespace: Syncfusion.Blazor.QueryBuilder
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class QueryBuilderTemplates : OwningComponentBase
    Remarks

    The QueryBuilderTemplates component is used within a QueryBuilderColumn to define custom templates for rendering column values, headers, and other elements in the Query Builder UI.

    Examples

    In the following example, a ValueTemplate is defined for a column in the SfQueryBuilder<TValue>.

    <SfQueryBuilder TValue="Employee" Rule="rule">
        <QueryBuilderColumns>
            <QueryBuilderColumn Field="EmployeeID" Label="Employee ID" Type="ColumnType.Number" />
            <QueryBuilderColumn Field="FirstName" Label="First Name" Type="ColumnType.String" />
            <QueryBuilderColumn Field="LastName" Label="Last Name" Type="ColumnType.String">
                <QueryBuilderTemplates>
                    <ValueTemplate Context="rule">
                        @{
                            var templateRule = rule as RuleModel;
                            <SfTextBox @bind-Value="@templateRule.Value"></SfTextBox>
                        }
                    </ValueTemplate>
                </QueryBuilderTemplates>
            </QueryBuilderColumn>
        </QueryBuilderColumns>
    </SfQueryBuilder>

    Constructors

    QueryBuilderTemplates()

    Declaration
    public QueryBuilderTemplates()

    Properties

    ColumnTemplate

    Gets or sets the template for rendering a column in the SfQueryBuilder<TValue>.

    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 context is of type RuleModel. The default value is null.

    Remarks

    This template provides a way to customize the entire column's rendering, including its label and input control. The context gives you access to the rule's details, which can be used to dynamically render the column's content.

    HeaderTemplate

    Gets or sets the template for the group header in the SfQueryBuilder<TValue>, which displays the logical (AND/OR) condition.

    Declaration
    public RenderFragment<HeaderTemplateModel> HeaderTemplate { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.RenderFragment<HeaderTemplateModel>

    A Microsoft.AspNetCore.Components.RenderFragment<> that defines the template for the group header. The context is of type HeaderTemplateModel. The default value is null.

    Remarks

    This template allows for the customization of the group header, enabling the integration of additional widgets or custom layouts alongside the AND/OR condition selector.

    ValueTemplate

    Gets or sets the template for rendering the value of a SfQueryBuilder<TValue> column.

    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 column's value. The context is of type RuleModel. The default value is null.

    Remarks

    This template allows you to customize the appearance and behavior of the input control used for the column's value. The context provides access to the current rule's properties, which can be used to bind the value to a custom component.

    Methods

    OnInitializedAsync()

    Initializes the component and updates the parent QueryBuilderColumn or SfQueryBuilder<TValue> with the defined templates.

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task that represents the asynchronous initialization process.

    Remarks

    This method is part of the Blazor component lifecycle and is invoked when the component is first initialized. It passes the template definitions to the parent component to ensure they are correctly applied during rendering.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved