Query Builder TemplateColumn
SIGN IN To post a reply.
12 Replies
SD
Saranya Dhayalan
Syncfusion Team
September 9, 2020 06:36 AM UTC
Hi Jim,
Thank you for contacting Syncfusion support
We have checked your reported, you can achieve this by using column templating. In this you can set the remote data of dropdownlist for “payment mode” column. Please find the below code snippet:
|
@using Syncfusion.Blazor.QueryBuilder
@using Syncfusion.Blazor.DropDowns
@using Syncfusion.Blazor.Buttons
@using Syncfusion.Blazor.Inputs
@using Syncfusion.Blazor.Data
<div class="col-lg-12 control-section">
<SfQueryBuilder Width="70%" ModelType="typeof(SfQueryBuilder)">
<QueryBuilderRule Condition="and" Rules="@Rules"></QueryBuilderRule>
<QueryBuilderColumns>
<QueryBuilderColumn Field="Category" Label="Category" Type="string"></QueryBuilderColumn>
<QueryBuilderColumn Field="PaymentMode" Label="PaymentMode" Type="string" Values="@DropValue">
<Template>
<SfDropDownList TValue="string" TItem="OrderDetails" PopupHeight="230px" Placeholder="Select a name" Query="@RemoteDataQuery">
<SfDataManager Url="https://js.syncfusion.com/demos/ejServices/Wcf/Northwind.svc/Orders" CrossDomain="true" Adaptor="Syncfusion.Blazor.Adaptors.ODataAdaptor"></SfDataManager>
<DropDownListFieldSettings Text="CustomerID" Value="CustomerID"></DropDownListFieldSettings>
</SfDropDownList>
</Template>
</QueryBuilderColumn>
<QueryBuilderColumn Field="TransactionType" Label="TransactionType" Type="boolean" Values="@CheckboxValue">
<Template>
<SfCheckBox TChecked="bool" Label="Is Expensive" Checked="true" ValueChange="@CheckboxChange">
</SfCheckBox>
</Template>
</QueryBuilderColumn>
<QueryBuilderColumn Field="Description" Label="Description" Type="string"></QueryBuilderColumn>
<QueryBuilderColumn Field="Date" Label="Date" Type="date"></QueryBuilderColumn>
<QueryBuilderColumn Field="Amount" Label="Amount" Type="number" Values="@SliderValue">
<Template>
<SfSlider TValue="string" Min="0" Max="100" Value="@DefaultSliderValue">
<SliderEvents TValue="string" OnChange="SliderChange"></SliderEvents>
</SfSlider>
</Template>
</QueryBuilderColumn>
</QueryBuilderColumns>
</SfQueryBuilder>
</div>
@code{
public string SliderValue { get; set; }
public string DefaultValue = "Cash";
public string DefaultSliderValue = "50";
public string DropValue { get; set; }
bool Done { get; set; } = true;
string CheckboxValue => Done ? "IsExpensive" : "Income";
public void OnChange(Syncfusion.Blazor.DropDowns.ChangeEventArgs<string> args)
{
DropValue = args.Value;
}
public void SliderChange(Syncfusion.Blazor.Inputs.SliderChangeEventArgs<string> args)
{
SliderValue = args.Value;
}
public void CheckboxChange(Syncfusion.Blazor.Buttons.ChangeEventArgs<bool> args)
{
Done = args.Checked;
}
public Query RemoteDataQuery = new Query().Select(new List<string> { "CustomerID" }).Take(6).RequiresCount();
public class OrderDetails
{
public int? OrderID { get; set; }
public string CustomerID { get; set; }
public int? EmployeeID { get; set; }
public double? Freight { get; set; }
public string ShipCity { get; set; }
public bool Verified { get; set; }
public DateTime? OrderDate { get; set; }
public string ShipName { get; set; }
public string ShipCountry { get; set; }
public DateTime? ShippedDate { get; set; }
public string ShipAddress { get; set; }
}
List<RuleModel> Rules = new List<RuleModel>()
{
new RuleModel { Label="Category", Field="Category", Type="string", Operator="equal", Value="Clothing" },
new RuleModel { Condition="or", Rules = new List<RuleModel>() {
new RuleModel { Label="Payment Mode", Field="PaymentMode", Type="string", Operator="equal", Value="Cash" },
new RuleModel { Label="TransactionType", Field="TransactionType", Type="boolean", Operator="equal", Value="Is Expensive" },
} },
new RuleModel { Label="Amount", Field="Amount", Type="number", Operator="equal", Value=50 }
};
}
<style>
.e-query-builder {
margin: 0 auto;
}
.e-control-wrapper.e-slider-container.e-horizontal {
height: 0;
}
</style>
|
Please find the below sample link for the column template support
Please check the above sample and get back to us if you need further assistance on this.
Regards,
Saranya D
JI
Jim
September 9, 2020 02:21 PM UTC
That works great. Thanks, Saranya!
SD
Saranya Dhayalan
Syncfusion Team
September 10, 2020 10:02 AM UTC
Hi Jim,
Most Welcome…
We are happy to hear that your requirement has been fulfilled. Kindly get back to us if you need any further assistance.
Regards,
Saranya D
JI
Jim
September 19, 2020 02:24 AM UTC
Hi Saranya.
I am getting an error thrown when clicking the Remove this condition X. Uncaught TypeError: Cannot read property 'id' of null.
I traced it to the following line in the querybuilder-c52f82.min.js file
(s = this.getColumn(a.rules[d].field)) && s.template && this.templateDestroy(s, i.querySelector(".e-template").id),
I think the class should be .e-blazor-template rather than .e-template.
JI
Jim
September 22, 2020 02:10 AM UTC
Additionally, changing the operator breaks the template component. For example, changing PaymentMode to the In operator.
MK
Mohan Kumar Ramasamy
Syncfusion Team
September 22, 2020 04:24 PM UTC
Hi Jim
We have checked your reported query, we can reproduce the reported issue in our end. We have logged an issue report for this, and we will include this fix in our upcoming release. You can track the status in the below feedback link.
Regards,
Mohankumar R
JI
Jim
October 16, 2020 06:58 PM UTC
Hi.
I tried to upgrade the example project above to v18.3.41 and it is throwing a large number of errors. I tried the documentation but it is not updated.
MK
Mohan Kumar Ramasamy
Syncfusion Team
October 20, 2020 02:24 AM UTC
Hi Jim,
Sorry for the inconvenience caused. In our latest version (v18.3.35), we have included some breaking changes in Querybuilder component. We would like you to review the breaking changes from the below location before you upgrade.
For your reference, We have prepared a sample based on this, please refer below link.
We will update the same in our documentation.
If you are still facing the issue, kindly share the below details.
- If possible, try to reproduce the reported issue in provided sample or share the issue reproducible sample
Please provide the above requested information, based on that we will check and provide you a better solution quickly.
Regards,
Mohankumar R
JI
Jim
October 20, 2020 02:45 AM UTC
MK
Mohan Kumar Ramasamy
Syncfusion Team
October 20, 2020 12:29 PM UTC
Hi Jim,
Thanks for update. We have prepared a sample for Query builder template. Please refer below link.
Link: https://www.syncfusion.com/downloads/support/forum/157731/ze/157731-QueryBuilderTemplate-1155191998
Please let us know, if you need any further assistance.
Regards,
Mohan kumar R
JI
Jim
October 21, 2020 12:11 AM UTC
Looks great. Thanks!
MK
Mohan Kumar Ramasamy
Syncfusion Team
October 21, 2020 09:53 AM UTC
Hi Jim,
Thanks for the update.
We are happy to hear that your requirement has been fulfilled. Please feel free to contact us if you need any further assistance on this.
Regards,
Mohan kumar R
SIGN IN To post a reply.
- 12 Replies
- 3 Participants
-
JI Jim
- Sep 9, 2020 12:38 AM UTC
- Oct 21, 2020 09:53 AM UTC