Last Updated: 23 Aug 2019 13:17 by ADMIN
Release 1.6.0
Created on: 12 Aug 2019 10:03
Category: TreeView
Type: Bug Report
Changing the data source with different expand states results in Microsoft.JSInterop.JSException: 'Cannot read property 'scrollHeight' of null
When you change the data source of the treeview and the new data has a different set of Expanded states than the old data, you will get a `Microsoft.JSInterop.JSException: 'Cannot read property 'scrollHeight' of null` in VS. It will also fail to show you proper debug information, symbols and source code.

Simple Repro

@using Telerik.Blazor.Components.TreeView
<button class="btn btn-primary" @onclick="@(() => ChangeTreeData(false))">Change tree data</button>
<TelerikTreeView Data="@FlatData">
        <TelerikTreeViewBinding ParentIdField="Parent" ExpandedField="IsExpanded"></TelerikTreeViewBinding>
@code {
    public List<TreeItem> FlatData { get; set; } = new List<TreeItem>();
    public class TreeItem //most fields use the default names and will bind automatically in this example
        public int Id { get; set; }
        public string Text { get; set; }
        public int? Parent { get; set; } //this is a non-default field name
        public bool HasChildren { get; set; }
        public bool IsExpanded { get; set; } //this is a non-default field name
    protected override void OnInit()
    int currIndex { get; set; } = 0;
    void ChangeTreeData(bool expandItems)
        List<TreeItem> data = new List<TreeItem>();
        data.Add(new TreeItem { Id = currIndex, HasChildren = true, IsExpanded = expandItems, Parent = null, Text = $"root {currIndex}" });
        data.Add(new TreeItem { Id = currIndex + 1, HasChildren = false, IsExpanded = expandItems, Parent = currIndex, Text = $"root {currIndex}: child one" });
1 comment
Marin Bratanov
Posted on: 19 Aug 2019 15:18
Hi to anyone following this,

We are working on it, and I am leaving here for posterity another test case that leads to the same error:

Marin Bratanov
Progress Telerik UI for Blazor