alexa
menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class QueryBuilderTemplates

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

    Inheritance
    object
    ComponentBase
    OwningComponentBase
    SfOwningComponentBase
    QueryBuilderTemplates
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    Inherited Members
    ComponentBase.Assets
    ComponentBase.AssignedRenderMode
    ComponentBase.BuildRenderTree(RenderTreeBuilder)
    ComponentBase.DispatchExceptionAsync(Exception)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.OnAfterRender(bool)
    ComponentBase.OnAfterRenderAsync(bool)
    ComponentBase.OnInitialized()
    ComponentBase.OnParametersSet()
    ComponentBase.OnParametersSetAsync()
    ComponentBase.RendererInfo
    ComponentBase.SetParametersAsync(ParameterView)
    ComponentBase.ShouldRender()
    ComponentBase.StateHasChanged()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    OwningComponentBase.Dispose(bool)
    OwningComponentBase.IsDisposed
    OwningComponentBase.ScopedServices
    Namespace: Syncfusion.Blazor.QueryBuilder
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class QueryBuilderTemplates : SfOwningComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
    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
    [Parameter]
    public RenderFragment<RuleModel> ColumnTemplate { get; set; }
    Property Value
    Type Description
    RenderFragment<RuleModel>

    A RenderFragment<TValue> 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
    [Parameter]
    public RenderFragment<HeaderTemplateModel> HeaderTemplate { get; set; }
    Property Value
    Type Description
    RenderFragment<HeaderTemplateModel>

    A RenderFragment<TValue> 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
    [Parameter]
    public RenderFragment<RuleModel> ValueTemplate { get; set; }
    Property Value
    Type Description
    RenderFragment<RuleModel>

    A RenderFragment<TValue> 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
    Task

    A Task that represents the asynchronous initialization process.

    Overrides
    ComponentBase.OnInitializedAsync()
    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.

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved