Class RuleModel
Defines the properties for a single rule or a group of rules within the Query Builder.
Inheritance
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Remarks
The data type of this value should correspond to the Type of the rule's field for accurate evaluation.