<ejs-querybuilder id="querybuilder" width="73%" rule="ViewBag.rule" dataSource="ViewBag.dataSource" maxGroupCount=5 created ="createdControl" change ="change">
<e-querybuilder-columns>
//..
<e-querybuilder-column field="Title" label="Title" type="string"></e-querybuilder-column>
</e-querybuilder-columns>
</ejs-querybuilder>
<script>
function createdControl() {
// Binding open event intially while creating the control
var ddlColl = document.querySelectorAll('.e-filter-input');
for (var i = 0; i < ddlColl.length; i++) {
var ddl = ej.base.getComponent(ddlColl[i], "dropdownlist");
ddl.open = Open
}
}
//Trigger before opening DropDownList
function Open() {
if (!this.popupObj.element.querySelectorAll(".e-list-item")[3].classList.contains("e-disable")) {
this.popupObj.element.querySelectorAll(".e-list-item")[3].classList.add("e-disable")
}
}
function change(args) {
if (args.type.indexOf('insert') > -1) {
// Binding open event while creating new rules
var qryBldrObj = ej.base.getComponent(document.getElementById("dropdownlist"), 'dropdownlist');
var ddlColl = document.querySelector("#querybuilder_" + args.groupID).querySelectorAll('.e-filter-input');
var ddl = ej.base.getComponent(ddlColl[ddlColl.length - 1], "dropdownlist");
ddl.open = Open
}
}
</script>
<style>
.e-disable {
opacity: 0.6;
pointer-events: none;
}
</style> |
<ejs-querybuilder id="querybuilder" width="73%" rule="ViewBag.rule" dataSource="ViewBag.dataSource" maxGroupCount=5 change="change">
<e-querybuilder-columns>
<e-querybuilder-column field="EmployeeID" label="Employee ID" type="number" operators="ViewBag.Operator"></e-querybuilder-column>
..//
</e-querybuilder-columns>
</ejs-querybuilder>
<script>
function change(args) {
if (args.type == "field" && args.value && args.ruleID) {
var obj = ej.base.getComponent(document.getElementById("querybuilder_" + args.ruleID + "_operatorkey"), 'dropdownlist');
obj.value = 'equal'; // bind the value for operator dropdownlist
obj.dataBind();
}
}
</script> |