I want to integrate the Kendo UI TreeView component and Grid together such that the data in the Grid changes when interacting with the TreeView tabs.
2 Answers, 1 is accepted
0
Neli
Telerik team
answered on 29 Sep 2023, 12:37 PM
Hi Aaqib,
I will need some additional time to review the provided requirements. I will get back to you with more information on the matter in the beginning of the next week. Thank you very much for your patience.
Linked below you will find a runnable example where the value in the TreeView can be changed based on the selection in the Grid. In the example, select a Node in the TreeView and a row in the Grid and then click the 'Set value' button. The text of the selected node in the TreeView will be changed.
$('#btn').kendoButton({
themeColor: 'success',
click: function(e){
//gridvar grid = $("#grid").data('kendoGrid')
var gridSelected = grid.select()
var gridDataItem = grid.dataItem(gridSelected);
//treeviewvar treeView = $("#treeview").data('kendoTreeView')
var treeViewSelected = treeView.select()
var tvDataItem = treeView.dataItem(treeViewSelected);
if(tvDataItem && gridDataItem){
tvDataItem.set('FullName', gridDataItem.ProductName )
}else{
alert('please select an item in the TreeView and in the Grid')
}
}
})
I hope you will find the example helpful. Let me know in case you have additional questions on the matter.