Hello,
After playing with the QueryBuilder demos, I have a few questions about how much customization it supports.
<ejs-querybuilder #querybuilder [dataSource]="dataSource" [rule]="importRules" [columns]="filter" [fieldMode]="fieldMode" [separator]="separator" [fieldModel]="fieldModel">
</ejs-querybuilder>
|
fieldModel: DropDownListModel = { allowFiltering: true };
|
<e-column field="EmployeeID" label="Employee ID" type="number" category="Advanced one"></e-column>
<e-column field="FirstName" label="First Name" type="string"></e-column>
<e-column
field="TitleOfCourtesy"
label="Title Of Courtesy"
type="boolean"
[values]="values"
></e-column>
<e-column field="Title" label="Title" type="string"></e-column>
<e-column
field="HireDate"
label="Hire Date"
type="date"
format="dd/MM/yyyy"
></e-column>
<e-column
field="Country"
label="Country"
type="string"
category="Landmark"
></e-column>
<e-column
field="Country"
label="City"
type="string"
category="Landmark"
></e-column>
|
Hello,
Thank you for your helpful answers.
I do have a followup - in the example you provided for the categories, the categories seem to not be able to be expanded and collapsed, is this the case? We currently have groups that have dozens of fields, so having them all be displayed at the same time like that would make it difficult to scroll through.
This is what we currently have that we want to bring to the web, with fields grouped under different categories, and some nested categories as well:
Is it possible to have columns grouped like this under categories that can be displayed in this manner? That is, in groups that don't all appear within the field editor so the user has to scroll through the whole list?
Thank you,
KS
<ejs-querybuilder
id="querybuilder"
#querybuilder
width="70%"
created="created()"
[dataSource]="data"
>
<e-columns>
<ng-template #ruleTemplate let-data>
<div class="e-rule e-rule-template">
<div class="e-rule-filter e-custom-filter">
<ejs-contextmenu
id="contextmenu"
[items]="menuItems"
(select)="fieldChange($event)"
></ejs-contextmenu>
<!-- To Render Button. -->
<button id="btn" ejs-button (click)="btnClick()">
Open ContextMenu
</button>
</div>
</div>
</ng-template>
</e-columns>
</ejs-querybuilder>
|
Hello,
Thank you for your response and your example.
When trying out the given sample, it seems like even though the context menu does appear as I would like it to, whenever I select a field value or try to change the operation/value, it flickers and resets the values, and does not work. I am not sure if this is intentional or if the button being in place of the dropdown is causing issues.
Is this expected? From what I can tell, that sample project looks good, but I am not able to build any queries with it.
Thank you,
KS
<ng-template #ruleTemplate let-data>
<div class="e-rule e-rule-template">
<div class="e-rule-filter e-custom-filter">
<div id="contextmenutarget">{{content}}</div>
<ejs-contextmenu
id="contextmenu"
target="#contextmenutarget"
[items]="menuItems"
(select)="fieldChange($event)"
></ejs-contextmenu>
</div>
<div class="e-rule-operator e-operator">
<ejs-dropdownlist
(change)="operatorChange($event)"
[fields]="fields"
[dataSource]="operator"
[value]="data.rule.operator"
>
</ejs-dropdownlist>
</div>
|
Hello,
Thank you for the updated sample.
I have tried it out with multiple conditions, and when I select a different field for the second condition, the operations and values reset, and all of the field names change to the newly selected field. When this happens, the sql output is also not correct.
Is this expected behavior? It seems like all of the other conditions getting changed should not be occurring.
Thank you,
KS
<ng-template #ruleTemplate let-data>
<div class="e-rule e-rule-template">
<div class="e-rule-filter e-custom-filter">
<div class="e-text-menu-input" id="{{data.ruleID}}_inputId"></div>
<ejs-menu
[items]="menuItems"
class="e-field-context"
[fields]="menuFields"
id="{{data.ruleID}}_menuId"
(select)="fieldChange($event ,data.ruleID)"
></ejs-menu>
</div>
<div class="e-rule-operator e-operator">
<ejs-dropdownlist
(change)="operatorChange($event)"
[fields]="fields"
[dataSource]="operator"
[value]="data.rule.operator"
>
</ejs-dropdownlist>
</div>
<div>
<div class="e-slider-value">
<ejs-slider
[ticks]="rangeticks"
min="30"
max="50"
id="{{data.ruleID}}_valuekey0"
(change)="valueChange($event, data.ruleID)"
(created)="sliderCreated(data.ruleID)"
[value]="data.rule.value"
>
</ejs-slider>
</div>
<div class="e-rule-btn">
<button
class="e-removerule e-rule-delete e-css e-btn e-small e-round"
>
<span class="e-btn-icon e-icons e-delete-icon"></span>
</button>
</div>
</div>
</div>
</ng-template>
|
fieldChange(args: any, id): void {
var element = document
.getElementById(id)
.querySelector('.e-text-menu-input');
if (args.item.text != '') {
this.qryBldrObj.notifyChange(args.item.text, element, 'field');
}
}
operatorChange(e: any): void {
if (!e.isInteracted) {
return;
}
this.qryBldrObj.notifyChange(e.value, e.element, 'operator');
}
valueChange(e: any, ruleID: string): void {
if (e.isInteracted) {
let elem: HTMLElement = document.getElementById(ruleID);
this.qryBldrObj.notifyChange(e.value as Date, elem, 'value');
}
}
|
Hello,
Thank you again for your sample.
This functionality is what we wanted to capture, and I appreciate all of your help. But the one thing that would help us is to be able to see which field is selected for each condition once the user selects it from the context menu. Is that possible with this latest sample you have provided?
Thank you,
KS
Hi KS,
Thanks for the update.
We have checked your reported requirement and we can be able to achieve this in sample level, please find the below code snippets
fieldChange(args: any, id): void { var element = document .getElementById(id) .querySelector('.e-text-menu-input'); if (args.item.text != '') { console.log(args.item.text); // here we get the selected field name this.qryBldrObj.notifyChange(args.item.text, element, 'field'); } } |
For your reference we have prepared a sample,
Sample link: https://stackblitz.com/edit/angular-9vr8dh-latjvs?file=app.component.ts
Please get back to us, if you need any further assistance on this.
Regards,
Thaneegairaj S