Smart UI Components & Libraries – Grid, Scheduler, Gantt, Kanban for Angular, React, Next.js, Vue, Blazor, JavaScript › Forums › General Discussions › How to get values from query builder in blazor
Tagged: blazer, Query Builder
- This topic has 2 replies, 2 voices, and was last updated 3 years ago by
Pavan Muram.
-
AuthorPosts
-
January 17, 2023 at 7:35 am #104236
Pavan Muram
ParticipantI would like to get data from query builder after every click event in blazer. I did try ItemClicked unable to use it properly and understand it. Any example will really help
-
This topic was modified 3 years ago by
Pavan Muram.
January 17, 2023 at 4:27 pm #104248ivanpeevski
ParticipantHi 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.Serializationvalue 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/January 18, 2023 at 6:24 am #104249Pavan Muram
ParticipantHi Ivan,
Is it possible to create dropdown with predefined values in the values input box ?
And the code is throwing RuntimeBinderException that String and dynamic shouldn’t be used. I should use String and Object.
Even that doesn’t work any thoughts ?
Thanks,
Pavan
-
This topic was modified 3 years ago by
-
AuthorPosts
- You must be logged in to reply to this topic.