[PR #1678] [MERGED] Add Reload method to RadzenTree #2855

Open
opened 2026-01-29 18:20:46 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/radzenhq/radzen-blazor/pull/1678
Author: @crowbar27
Created: 9/5/2024
Status: Merged
Merged: 9/6/2024
Merged by: @enchev

Base: masterHead: master


📝 Commits (3)

  • 0bb1438 Added demo to illustrate the refresh problem with dynamic loading.
  • 170eca1 Added RadzenTree.Reload public API.
  • f7394b6 Documentation added.

📊 Changes

4 files changed (+122 additions, -0 deletions)

View changed files

📝 Radzen.Blazor/RadzenTree.razor.cs (+29 -0)
RadzenBlazorDemos/Pages/TreeDataBindingRefresh.razor (+73 -0)
RadzenBlazorDemos/Pages/TreeDataBindingRefreshPage.razor (+12 -0)
📝 RadzenBlazorDemos/Services/ExampleService.cs (+8 -0)

📄 Description

This PR follows up on the discussion at https://forum.radzen.com/t/programmatically-refresh-branch-of-radzentree-created-in-expand-callback/17892.

The problem to be solved are trees that are lazily created from a data source that is outside the control of the application like the file system tree example. If that example would be exteded to allow users adding files, the tree needs to be reloaded programmatically after the operation completed.

The internal RadzenTree.ExpandItem method would re-evaluate the RadzenTree.Expand callback, but it cannot be called outside. As I am unsure whether there are any unforeseen consequences of making this API public, I have instead added a new RadzenTree.Reload method that calls ExpandItem instead.

The TreeDataBindingRefresh example in the PR demonstrates how I would imagine the API being used. Note that it is a bit pointless to use an in-memory source, but creating an example that allows for writing on the server seemed unwise.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/radzenhq/radzen-blazor/pull/1678 **Author:** [@crowbar27](https://github.com/crowbar27) **Created:** 9/5/2024 **Status:** ✅ Merged **Merged:** 9/6/2024 **Merged by:** [@enchev](https://github.com/enchev) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (3) - [`0bb1438`](https://github.com/radzenhq/radzen-blazor/commit/0bb143832535dbb377d5c16087dcd6ff67346439) Added demo to illustrate the refresh problem with dynamic loading. - [`170eca1`](https://github.com/radzenhq/radzen-blazor/commit/170eca170bf42e1e34a1e48ad35b547ca7a490f8) Added RadzenTree.Reload public API. - [`f7394b6`](https://github.com/radzenhq/radzen-blazor/commit/f7394b6589e0d07c3e962b1167c4ec94bc489f0f) Documentation added. ### 📊 Changes **4 files changed** (+122 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `Radzen.Blazor/RadzenTree.razor.cs` (+29 -0) ➕ `RadzenBlazorDemos/Pages/TreeDataBindingRefresh.razor` (+73 -0) ➕ `RadzenBlazorDemos/Pages/TreeDataBindingRefreshPage.razor` (+12 -0) 📝 `RadzenBlazorDemos/Services/ExampleService.cs` (+8 -0) </details> ### 📄 Description This PR follows up on the discussion at https://forum.radzen.com/t/programmatically-refresh-branch-of-radzentree-created-in-expand-callback/17892. The problem to be solved are trees that are lazily created from a data source that is outside the control of the application like the file system tree example. If that example would be exteded to allow users adding files, the tree needs to be reloaded programmatically after the operation completed. The internal `RadzenTree.ExpandItem` method would re-evaluate the `RadzenTree.Expand` callback, but it cannot be called outside. As I am unsure whether there are any unforeseen consequences of making this API public, I have instead added a new `RadzenTree.Reload` method that calls `ExpandItem` instead. The `TreeDataBindingRefresh` example in the PR demonstrates how I would imagine the API being used. Note that it is a bit pointless to use an in-memory source, but creating an example that allows for writing on the server seemed unwise. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 18:20:46 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#2855