Declined
Last Updated: 24 Aug 2022 15:13 by ADMIN
Created by: Matt
Comments: 1
Category: TreeList
Type: Feature Request
0

From what I can see, currently the only way to set the expanded items for a TreeList is through the state.

The main problem is that the state doesn't fire the OnExpand event, meaning that if you have a server loaded tree you need to make sure to load the data before each item is expanded. It also allows for duplicates in the 'ExpandedItems' if you don't check for duplicates before adding to it.

The TreeView has an 'ExpandedItems' parameter that can be bound which is a bit nicer than using the state, but from my quick test this also doesn't fire the OnExpand event.

 

My request is for one of the following to be added:

  1. Similar to how you can set the 'HasChildrenField' or 'ItemsField' on the TreeList, allow a 'IsExpandedField' value to be bound (Should fire the OnExpand when changed if possible). This would be the simplest way allow bindable control over the expansion of items while also making it so we don't have to manage duplicates in the 'ExpandedItems' collection.
  2. Expose a method to expand/unexpand rows. This would be different to manually changing the state as it would also fire the OnExpand event for each row expanded.
  3. Similar to the TreeView, allow an 'ExpandedItems' to be bound. Preferably this would also fire the OnExpand event.
Declined
Last Updated: 27 Apr 2021 12:13 by ADMIN

Issue - While restoring the tree list state from local storage any items that were expanded are not re-expanded

Repo - https://github.com/benhysell/BlazorGridPagingIssue

Example Inspired By - https://docs.telerik.com/blazor-ui/components/treelist/state#save-and-load-treelist-state-from-browser-localstorage

Steps to Reproduce

Expected behavior - Elements that had been expanded would be expanded again.

Details

Following the example https://docs.telerik.com/blazor-ui/components/treelist/state#save-and-load-treelist-state-from-browser-localstorage I copied the code into my application, however I wanted to save which items were expanded, so I commented out:

 state.ExpandedItems = null;

Looking at the resulting entries in local storage, it appears the ExpandedItems list is properly saved to local storage.

I added some logging to the OnStateInitHandler so I could see what was happening on load, my desired result was to ensure:

  • If there is nothing in local storage, collapse all items
  • If someone had stored some information in local storage use it

It appears everything is going out to local storage, and coming back in without issue, however the state of the expanded items is not reflected in the control.

 

Declined
Last Updated: 20 Oct 2020 16:08 by ADMIN
Created by: Georgia N.
Comments: 3
Category: TreeList
Type: Bug Report
0

I use Guids to identify data in my application. It is a lot more reliable than using integers; however, it appears as if the TreeList does not support the use of Guids for the Id and ParentId fields when building the list's view.

---

ADMIN EDIT

This was not a bug, it was probably a configuration issue, as the scenario works, so this is marked as "declined". See the thread below for a sample.

---