Updated/added node items in treeview not visible (given "k-hidden"-property)

0 Answers 72 Views
TreeView
Erik
Top achievements
Rank 1
Erik asked on 19 Sep 2023, 02:07 PM

Hello,

I have encountered an issue when I manipulate the array which I use for [nodes] in my kendo-treeview. When a new item is added to the array, or an old one is updated, they simply disappear from view. Since I knew that the array contained the new/updated item I eventually realized that it was in fact still being rendered in the HTML, just with the added "k-hidden" property - thus not being visible. 

I'm yet to figure out a good solution to this problem. I could in theory use ::ng-deep to disable the default behaviour of .k-hidden in the component, but then I can no longer use the filtering function as it relies upon being able to use k-hidden. 

How come the newly added or updated items in my array get the "k-hidden" property in the first place though? Here's an example of the code:

<kendo-treeview 
                  [nodes]="dataService.tables"
                  [filterable]="true"
                  [expandOnFilter]="{expandedOnClear: 'initial'}"
                  [textField]="['tableName', 'tableColumnName']"
                  kendoTreeViewExpandable
                  kendoTreeViewSelectable
                  kendoTreeViewHierarchyBinding
                  (selectionChange)="onTableClick($event)"
                  childrenField="tableColumns">
</kendo-treeview>

With dataService.tables being a simple "Array<Table>" which I occasionally push new objects to. (when I say update I mean replace the old item in the array with a new one, not simply changing fields on the item in the array)

Here you can see the difference between the elements as viewed through the browser console:

Apologies if this question has already been answered, or if I'm glossing over something obvious. I did some research but couldn't find anything.

No answers yet. Maybe you can help?

Tags
TreeView
Asked by
Erik
Top achievements
Rank 1
Share this question
or