Hi Pavan,
You can achieve this by using the OnChange Event. The current value of query builder is an array of objects.
Here is a simple example, where the array value is transformed into string and shown in the page:
@page “/”
@using System.Text.Json
@using System.Text.Json.Serialization
value is: @currentValue
<QueryBuilder Fields=”fields” OnChange=”OnChange”></QueryBuilder>
@code {
string currentValue = “”;
QueryBuilder queryBuilder;
private List<QueryBuilderField> fields = new List<QueryBuilderField>() {
new QueryBuilderField()
{
Label = “Id”,
DataField = “id”,
DataType = “number”
},
new QueryBuilderField()
{
Label = “Product”,
DataField = “productName”,
DataType = “string”
},
new QueryBuilderField()
{
Label = “Unit Price”,
DataField = “price”,
DataType = “number”,
FilterOperations = new string[]{“=”, “<“, “>”}
},
new QueryBuilderField()
{
Label = “Purchased”,
DataField = “purchased”,
DataType = “date”
},
new QueryBuilderField()
{
Label = “Available”,
DataField = “available”,
DataType = “boolean”
}
};
private async void OnChange(Event ev)
{
var detail = JsonSerializer.Deserialize<Dictionary<string, dynamic>>(ev[“detail”]);
currentValue = string.Join(“,”, detail[“value”]);
}
}
Best Regards,
Ivan Peevski
Smart UI Team
https://www.htmlelements.com/