Hi Pham Chi Trung,
Greetings from Syncfusion support.
We have checked your reported problem with TreeView component. You can check the TreeView nodes using any one of the below case.
Case 1: By setting isChecked in datasource.
When isChecked is set to true in dataSource of TreeView component, it automatically checks the corresponding TreeView node.
|
{
id: 2,
pid: 1,
name: "Laura Callahan",
isChecked: true,
eimg:
job: "Product Manager",
hasChild: true,
}, |
Case 2: using checkedNodes API.
You can change the checked nodes of TreeView using checkedNodes property.
Refer to the below code snippet.
|
methods: {
checkNode: function () {
var treeViewObj = document.getElementById("treeview").ej2_instances[0];
/*using function for checked nodes*/
treeViewObj.checkedNodes = ["8"];
},
}, |
Case 3: using checkAll method.
You can check the TreeView node by using node id as a argument for checkAll method of TreeView component.
|
methods: {
checkNode: function () {
var treeViewObj = document.getElementById("treeview").ej2_instances[0];
/*using function for checked nodes*/
treeViewObj.checkAll(["9", "8"]);
},
}, |
Refer to the sample link below.
To know more about the TreeView component, refer the below links.
Please let us know, if you need any further assistance.
Regards,
Sowmiya.P