default.html
<ejs-treeview #treeviewObj id="default" [loadOnDemand]=false [showCheckBox]=true [fields]='field' (dataBound)="dataBounded($event)" (nodeChecked)="nodeCheck($event)">
default.components.ts
//Change the dataSource for TreeView
changeDataSource(data) {
for (let i = 0; i < data.length; i++) {
let dataId = data[i]["uuid"].toString();
if (
this.listTreeObj.checkedNodes.indexOf(dataId) !== -1 &&
this.checkNodes.indexOf(dataId) === -1 && !data[i].hasChild
)
this.checkNodes.push(dataId);
}
this.listTreeObj.fields = {
dataSource: data,
id: "uuid",
text: "name",
parentID: "parent_id",
hasChildren: "hasChild"
};
} |
changeDataSource(data) {
for (let i = 0; i < data.length; i++) {
let dataId = data[i]["uuid"].toString();
if (
this.listTreeObj.checkedNodes.indexOf(dataId) !== -1 &&
this.checkNodes.indexOf(dataId) === -1 && !data[i].hasChild
)
this.checkNodes.push(dataId);
}
} |
Hello Keerthana,
Is there a way to turn off the intermediate state for the parent node and make it selectable separately in ejs-treeview component (just like in ejs-dropdowntree component)?
Best regards,
Ignacy Mielniczek
Hi Sebastian,
We have reviewed your query and understand that you would like to disable the intermediate state for checkboxes in the TreeView component. To achieve this, you can set the “autoCheck” property to false.
Refer to the below code snippet for further reference.
[app.component.ts]
<ejs-treeview id='treeelement' [fields]='field' [showCheckBox]='showCheckBox' [autoCheck]='false' > </ejs-treeview>
|
We have also attached a sample for your reference.
Sample : https://stackblitz.com/edit/github-ofrugg-ujjxx4?file=src%2Fapp.component.ts
Regards,
Suresh.