我如何访问 Kendo 中的树视图数据以便 Angular 递归地遍历树
我想知道是否有人知道如何访问 Kendo Angular TreeView 数据? 我像这样设置我的树视图组件,并允许用户通过拖放进行更改,这会触发添加后等事件。问题是该事件将具有拖动项目的新位置,但它没有太多信息新位置是什么,如果项目像项目 0_1_2 一样被拖出,并且 0_1_3 中有一个项目现在应该移动到 0_1_2。所以我正在寻找的是一种访问根节点的 dway,然后递归地向下遍历并使用新索引更新我的数据对象。
这就是我设置树视图组件的方式
<kendo-treeview
[nodes]="data"
textField="text"
kendoTreeViewHierarchyBinding
childrenField="items"
[filterable]="true"
kendoTreeViewExpandable
[expandedKeys]="expandedKeys"
[expandBy]="'text'"
[kendoTreeViewCheckable]="checkableSettings"
(checkedChange)="handleChecking($event)"
[(checkedKeys)]="checkedKeys"
checkBy="guid"
kendoTreeViewDragAndDrop
kendoTreeViewDragAndDropEditing
(nodeDragStart)="log('nodeDragStart', $event)"
(nodeDrag)="log('nodeDrag', $event)"
(nodeDrop)="handleDrop($event)"
(addItem)="log('addItem', $event)"
(removeItem)="log('removeItem', $event)"
(nodeDragEnd)="log('nodeDragEnd', $event)"
>
</kendo-treeview>
I am wondering if anyone knows how to access the Kendo Angular TreeView Data ?
I set up my treeview component like this and allow the user to make changes via drag and drop which fires off events like after add etc. The problem is that the event will have the new position of the dragged item but it doesnt have much info on what the new position is, if the item was drag out off like item was 0_1_2 and there was an item in 0_1_3 which should now move to 0_1_2. So what i am looking for is a dway to access the root node and then walk it down recursively and update my data object with new indexes.
This is how i setup my treeview component
<kendo-treeview
[nodes]="data"
textField="text"
kendoTreeViewHierarchyBinding
childrenField="items"
[filterable]="true"
kendoTreeViewExpandable
[expandedKeys]="expandedKeys"
[expandBy]="'text'"
[kendoTreeViewCheckable]="checkableSettings"
(checkedChange)="handleChecking($event)"
[(checkedKeys)]="checkedKeys"
checkBy="guid"
kendoTreeViewDragAndDrop
kendoTreeViewDragAndDropEditing
(nodeDragStart)="log('nodeDragStart', $event)"
(nodeDrag)="log('nodeDrag', $event)"
(nodeDrop)="handleDrop($event)"
(addItem)="log('addItem', $event)"
(removeItem)="log('removeItem', $event)"
(nodeDragEnd)="log('nodeDragEnd', $event)"
>
</kendo-treeview>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论