menu

Blazor

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

    Show / Hide Table of Contents

    Class RuleModel

    Defines the properties for a single rule or a group of rules within the Query Builder.

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

    The RuleModel class is used to structure conditions in the SfQueryBuilder<TValue>. Each instance can represent either an individual rule with a field, operator, and value, or a nested group of rules combined with a logical condition.

    Constructors

    RuleModel()

    Declaration
    public RuleModel()

    Properties

    Condition

    Gets or sets the condition for a group of rules, which determines how the rules in the group are combined.

    Declaration
    public string Condition { get; set; }
    Property Value
    Type Description
    System.String

    A string that represents the logical operator (e.g., "and", "or") for the group. The default value is null.

    Remarks

    This property is only applicable when the item is a group of rules (i.e., the Rules property is not empty). It is ignored for individual rules.

    Field

    Gets or sets the field name for the rule, which corresponds to a column in the data source.

    Declaration
    public string Field { get; set; }
    Property Value
    Type Description
    System.String

    A string representing the data field to which the rule applies. The default value is null.

    Remarks

    This property's value should match the Field of one of the columns defined in the SfQueryBuilder<TValue>.

    IsLocked

    Gets or sets a value indicating whether the rule is locked, preventing user modification.

    Declaration
    public bool IsLocked { get; set; }
    Property Value
    Type Description
    System.Boolean

    A bool. If true, the rule cannot be edited or deleted by the user. The default is false.

    Remarks

    Locked rules provide a way to create predefined, non-modifiable conditions within the Query Builder component.

    Label

    Gets or sets the display label for the field, which is shown in the user interface.

    Declaration
    public string Label { get; set; }
    Property Value
    Type Description
    System.String

    A string that represents the user-friendly name for the field. The default value is null.

    Remarks

    This label is typically displayed in the UI to represent the selected Field.

    Not

    Gets or sets a value indicating whether to apply a 'NOT' condition to the rule, inverting its logic.

    Declaration
    public Nullable<bool> Not { get; set; }
    Property Value
    Type Description
    System.Nullable<System.Boolean>

    A nullable bool. If true, the rule is negated. The default is null.

    Remarks

    When this property is set to true, the entire rule or group of rules is inverted. For example, "equals" becomes "not equals".

    Operator

    Gets or sets the operator for the rule, which defines the comparison logic.

    Declaration
    public dynamic Operator { get; set; }
    Property Value
    Type Description
    System.Object

    A dynamic value that represents the comparison operator (e.g., "equal", "greaterthan"). The default is null.

    Remarks

    The operator determines how the Field and Value are compared. The available operators are determined by the column's data type.

    RuleId

    Gets or sets the unique identifier for the rule.

    Declaration
    public string RuleId { get; set; }
    Property Value
    Type Description
    System.String

    A string that uniquely identifies the rule. The default is null.

    Remarks

    This ID is automatically generated and used internally by the SfQueryBuilder<TValue> to manage rules.

    Rules

    Gets or sets a collection of nested rules, which forms a rule group.

    Declaration
    public List<RuleModel> Rules { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<RuleModel>

    A System.Collections.Generic.List<> of RuleModel objects. The default is null.

    Remarks

    If this property is populated, the current RuleModel instance represents a group of rules, and the Condition property defines how they are combined.

    Type

    Gets or sets the data type of the rule's field, which influences the UI and validation.

    Declaration
    public string Type { get; set; }
    Property Value
    Type Description
    System.String

    A string that represents the data type (e.g., "string", "number", "boolean"). The default is null.

    Remarks

    This property helps determine which UI component and validation logic to use for the Value field.

    Value

    Gets or sets the value used for comparison in the rule.

    Declaration
    public dynamic Value { get; set; }
    Property Value
    Type Description
    System.Object

    A dynamic value that the Field is compared against using the specified Operator. The default is null.

    Remarks

    The data type of this value should correspond to the Type of the rule's field for accurate evaluation.

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