Unplanned
Last Updated: 19 Nov 2024 15:36 by Hannes

The TreeView exposes drag events that allow me to detect when the user drags an item and to get the information for the dragged item. I want to be able to drag that item outside of the TreeView and drop it in my custom target.

I am aware that I should handle the custom drop functionality. However, the @ondrop event of my custom target currently does not fire for the tree item: https://blazorrepl.telerik.com/QIblPZvd0412k6U128.

===

ADMIN EDIT

===

For the time being, you may implement the following custom approach:

  • Use the ItemTemplate.
  • Wrap the item text in a container.
  • Enable the draggable attribute of that container. Disable the Draggable parameter of the Treeview, so these properties do not interfere with each other. This approach overrides the built-in behavior of the drag-and-drop functionality, so it cannot be enabled at the same time.  If you want to keep the built-in draggable functionality, implement aa suitable UI that toggles that during runtime.
  • Handle the ondragstart event of the container.

Here is a basic sample showcasing the approach: https://blazorrepl.telerik.com/QIFbvZFA00bHZbsj23.

Completed
Last Updated: 19 Nov 2024 12:50 by ADMIN
Release 5.0.0 (15 Nov 2023) (R1 PI1)
Created by: Philip
Comments: 0
Category: TreeView
Type: Feature Request
9
I would like to have an event that fires when the Drag operation starts. 
Completed
Last Updated: 19 Nov 2024 07:12 by ADMIN
Release 2025 Q1 (Feb)

This REPL test page is based on the TreeView Filtering demo, but with added checkboxes.

  1. Check an item.
  2. Filter the TreeView data, so that the checked item is no longer present.
  3. Try to check another item.
  4. The TreeView will throw a NullReferenceException.

A possible workaround is to also filter (or clear) the collection that is bound to the CheckedItems parameter of the TreeView.

 
Completed
Last Updated: 15 Nov 2024 13:24 by ADMIN
Release 2024 Q4 (Nov)

We have the following scenario:

  • a dialog that contains a TreeView
  • the TreeView is not expanded, when the dialog is opened, only the root node is displayed
  • the children are loaded on demand, when the parent node is expanded
  • there is a public async Task LoadChildrenAsync() that loads the children from the source
  • the loading operation might take a few seconds

The problem is when you close the dialog before the loading is finished, a NullReferenceException occurs.

System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Blazor.Components.Common.Trees.TelerikTreeDataSource.GetTreeItems(IEnumerable`1 data, Int32 level, String parentIndex)

Completed
Last Updated: 14 Nov 2024 09:27 by ADMIN
Release 7.0.0

I am trying to restore the expanded items by programmatically populating the ExpandedItems collection of the TreeView.

I have overriden "Equals" on the model, so the items are not compared by reference but by a unique identifier. The problem is that the TelerikTreeView does not respect this override and does not expand the items.
Other controls with similar features do respect overriden implementation of "Equals".

Reproduction: https://blazorrepl.telerik.com/cSuKkqwu46w4sHaW53.

Declined
Last Updated: 04 Sep 2024 14:30 by ADMIN

Steps to reproduce:

  1. Open this edited Telerik REPL link, the original link came from TreeView - CheckBoxes, and I only changed "CheckedItems = Data.Skip(1).Take(2)" to "CheckedItems = Data.Skip(1).Take(4)".
  2. Run

Expected: Both the parent "Documents" and its 4 children should be checked.

Actual: Only the 4 children are checked; the parent remains unchecked.

This only happens when all children are checked. However, if not all children items are checked, the parent will also be checked.

Unplanned
Last Updated: 15 Aug 2024 11:56 by Jerome

The TreeView resets the checkbox state of its items when the app adds or removes a node to the component datasource.

A possible workaround is to reset the object reference of the CheckedItems parameter.

The following test page with a workaround is a modified version of TreeView - Refresh Data - Observable Data.

@using System.Collections.ObjectModel

<TelerikButton OnClick="@AddItem">Add Item</TelerikButton>

<TelerikButton OnClick="@RemoveItem">Remove Item</TelerikButton>

<p>
    TreeViewCheckedItems Count: @TreeViewCheckedItems.Count()
    <br />
    <label><TelerikCheckBox @bind-Value="@ApplyWorkaround" /> Apply Workaround</label>
</p>

<TelerikTreeView Data="@TreeViewData"
                 CheckBoxMode="@TreeViewCheckBoxMode.Multiple"
                 @bind-CheckedItems="@TreeViewCheckedItems" />

@code {
    private IEnumerable<object> TreeViewCheckedItems { get; set; } = new List<TreeItem>();
    private ObservableCollection<object> TreeViewData { get; set; } = new ObservableCollection<object>();

    private int LastId { get; set; }
    private bool ApplyWorkaround { get; set; }

    private void AddItem()
    {
        TreeViewData.Add(
            new TreeItem
            {
                Id = ++LastId,
                Text = $"Item {LastId}",
            });

        if (ApplyWorkaround)
        {
            TreeViewCheckedItems = new List<object>(TreeViewCheckedItems);
        }

    }

    private void RemoveItem()
    {
        if (TreeViewData.Count > 1)
        {
            TreeViewData.Remove(TreeViewData.Last());

            if (ApplyWorkaround)
            {
                TreeViewCheckedItems = new List<object>(TreeViewCheckedItems);
            }
        }
    }

    protected override void OnInitialized()
    {
        TreeViewData = new ObservableCollection<object>() {
            new TreeItem()
            {
                Id = ++LastId,
                Text = $"Item {LastId}"
            }
        };

        TreeViewCheckedItems = new List<object>() { TreeViewData.First() };
    }
    public class TreeItem
    {
        public int Id { get; set; }
        public int? ParentId { get; set; }
        public string Text { get; set; } = string.Empty;
        public bool HasChildren { get; set; }
    }
}

 

asdf

Unplanned
Last Updated: 11 Jun 2024 10:55 by Randeep
Created by: Randeep
Comments: 0
Category: TreeView
Type: Feature Request
1

I want to use a separate drag-and-drop mode in the TreeView similar to how the Drag column works for the rows in the Grid component. 

The main reason I am unable to use the current drag-and-drop behavior is that I cannot use an input component as part of the TreeView node.

Unplanned
Last Updated: 01 Feb 2024 13:22 by ADMIN
Created by: Christian
Comments: 14
Category: TreeView
Type: Feature Request
37
I would like to be able to optimize the rendering of the TreeView component with a feature similar to the Row Virtualization in the Grid.
Completed
Last Updated: 06 Nov 2023 07:41 by ADMIN
Created by: Support ATT
Comments: 1
Category: TreeView
Type: Feature Request
2
Expose an OnItemRender event, which is raised for each TreeView item. The args should allow setting a Class, that will be applied at the topmost element of the item itself.
Unplanned
Last Updated: 26 Oct 2023 08:23 by Michael
Try to update the node icon/text via the OnItemClick event. Every second click on a child node fails the update.
Unplanned
Last Updated: 11 Sep 2023 11:11 by Reto
Created by: Reto
Comments: 0
Category: TreeView
Type: Feature Request
2
Add an event that fires after the drag starts and before it ends. 
Unplanned
Last Updated: 26 Jul 2023 08:54 by ADMIN
Created by: Peter
Comments: 9
Category: TreeView
Type: Feature Request
11

Hi,

 

Is there a plan to support lines between treeview items as available in radtreeview?

 

radTreeView1.ShowLines = true; radTreeView1.LineStyle = TreeLineStyle.DashDot;

 

Without this it is very confusing to the end user what the connections between open items are.

 

Regards,


peter

 

 

 

 

Unplanned
Last Updated: 31 May 2023 12:17 by Rayko

The problem at hand arises when attempting to update the CheckedItems property of a TreeView control from within an async method.

The problem seems to be timing-related and is not always reproducible. The issue is observed most often when starting the project. It seems to be reproducible only in Blazor Server App.

Reproduction:
To reproduce the issue, try running the following snippet in a Blazor Server App.

 

@page "/"
<TelerikTreeView Data="@FlatData"
                 CheckBoxMode="@TreeViewCheckBoxMode.Multiple"
                 CheckParents="@true"
                 CheckChildren="@true"
                 CheckOnClick="@false"
                 @bind-CheckedItems="@SelectedItems">
</TelerikTreeView>

@code {
    List<TreeItem> FlatData { get; set; }
    IEnumerable<object> SelectedItems { get; set; } = new List<object>();
    protected override async Task OnInitializedAsync()
    {
        await GenerateData();
        await SelectDefault();
    }

    async Task SelectDefault()
    {
        await Task.Delay(100);
        SelectedItems = FlatData.Where(data => data.Id == 2);
    }
#pragma warning disable
    async Task GenerateData()
    {
        FlatData = new List<TreeItem>();

        FlatData.Add(new TreeItem()
            {
                Id = 1,
                Text = "Project",
                ParentId = null,
                HasChildren = true,
                Icon = "folder",
                Expanded = true
            });

        FlatData.Add(new TreeItem()
            {
                Id = 2,
                Text = "Design",
                ParentId = 1,
                HasChildren = true,
                Icon = "brush",
                Expanded = true
            });
        FlatData.Add(new TreeItem()
            {
                Id = 3,
                Text = "Implementation",
                ParentId = 1,
                HasChildren = true,
                Icon = "folder",
                Expanded = true
            });
    }

    public class TreeItem
    {
        public int Id { get; set; }
        public string Text { get; set; }
        public int? ParentId { get; set; }
        public bool HasChildren { get; set; }
        public string Icon { get; set; }
        public bool Expanded { get; set; }
    }
}

The second TreeItem should be selected.

 

 

Completed
Last Updated: 04 May 2023 10:07 by ADMIN
Release 4.2.0 (26/04/2023)

Checking a checkbox of a on demand-loaded child then collapsing and reopening its parent makes the checkbox disappear.  However, it is still checked in the CheckedItems collection, but just not in the UI.  See this REPL example.  Steps...

1. Expand a top level item

2. Check its child checkbox

3. Collapse the top level item

4. Expand it again

Result: checkbox gone (in the UI)

 

 

 


Completed
Last Updated: 06 Apr 2023 11:10 by ADMIN
Release 4.2.0 (04/26/2023)
Created by: Jan
Comments: 4
Category: TreeView
Type: Bug Report
1

Hello,

I have a TelerikTreeView with about 2000 items bound to an ObservableCollection (Data). I use SelectedItems, SelectedItemsChanged, SelectionMode multitple and @bind-ExpandedItems.

When my users manually expand the nodes of the treeview, everything is fine and the operation of the treeview works smoothly. Loading UI components based on user selection takes less than 50ms.

As soon as I set the "ExpandedItems" collection from code (according to your treeview demo), the whole treeview operation becomes painfully slow with waiting times of 2 to 4 SECONDS for selection and expansion. Already expanding from code takes several seconds.

As soon as I reset the ExpandedItems from code and collapse the complete tree, the treeview is usable again without delays.


Unplanned
Last Updated: 27 Mar 2023 08:30 by ADMIN
Completed
Last Updated: 21 Mar 2023 13:29 by ADMIN
Release 4.2.0 (26/04/2023)

The TreeView has CheckBoxMode="@TreeViewCheckBoxMode.Multiple" and CheckParents="true". Only some checkboxes are checked and there are parent checkboxes in indeterminate state.

When I try to clear all checked checkboxes, the indeterminate checkboxes are not cleared and maintain their state.

ADMIT EDIT:

Initially, this bug report was about unchecking all child items. However, it appears that the opposite behavior exists too - if all children are checked programmatically, the parent checkbox will show as indeterminate. In this case, check the parent explicitly as well.

Completed
Last Updated: 21 Mar 2023 13:06 by ADMIN
Release 4.2.0 (26/04/2023)

If the application expands TreeView items programmatically, and then the user tries to select multiple items, an exception will occur.

The issue is a regression that occurred in version 3.0.0. A possible workaround is to Rebind() the TreeView with a small delay after programmatic item expansion.

<TelerikTreeView @ref="@TreeViewRef"
                 Data="@FlatData"
                 @bind-ExpandedItems="@ExpandedItems"
                 SelectionMode="@TreeViewSelectionMode.Multiple"
                 SelectedItems="@SelectedItems"
                 SelectedItemsChanged="@((IEnumerable<object> items) => SelectedItemsHandler(items))" />

<TelerikButton OnClick="@ExpandAll">Expand All</TelerikButton>
<TelerikButton OnClick="@CollapseAll">Collapse All</TelerikButton>

@code {
    public TelerikTreeView TreeViewRef { get; set; }
    public IEnumerable<TreeItem> FlatData { get; set; }
    public IEnumerable<object> SelectedItems { get; set; } = new List<object>();
    public IEnumerable<object> ExpandedItems { get; set; } = new List<object>();

    async Task ExpandAll()
    {
        ExpandedItems = FlatData.Where(x => x.HasChildren == true);

        await Task.Delay(1);
        TreeViewRef.Rebind();
    }

    void CollapseAll()
    {
        ExpandedItems = new List<object>();
        SelectedItems = new List<object>();
    }

    void SelectedItemsHandler(IEnumerable<object> items)
    {
        SelectedItems = items;
    }
    protected override async void OnInitialized()
    {
        FlatData = LoadFlat();
    }

    int TreeLevels { get; set; } = 3;
    int ItemsPerLevel { get; set; } = 3;
    int IdCounter { get; set; } = 1;
    List<TreeItem> LoadFlat()
    {
        List<TreeItem> items = new List<TreeItem>();
        PopulateTreeItems(items, null, 1);
        return items;
    }
    void PopulateTreeItems(List<TreeItem> items, int? parentId, int level)
    {
        for (int i = 1; i <= ItemsPerLevel; i++)
        {
            var itemId = IdCounter++;
            items.Add(new TreeItem()
            {
                Id = itemId,
                Text = $"Level {level} Item {i} Id {itemId}",
                ParentId = parentId,
                HasChildren = level < TreeLevels
            });
            if (level < TreeLevels)
            {
                PopulateTreeItems(items, itemId, level + 1);
            }
        }
    }

    public class TreeItem
    {
        public int Id { get; set; }
        public string Text { get; set; }
        public int? ParentId { get; set; }
        public bool HasChildren { get; set; }
    }
}


Completed
Last Updated: 21 Mar 2023 12:59 by ADMIN
Release 4.2.0 (26/04/2023)
If the treeview is in a component within the `@Body` and so gets disposed on navigation, there are errors in a WebAssembly app.
1 2 3