-
-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TreeView: Add virtualization support (#5689)
* added virtualization support to treeview * Replaced a regular html anchor tag with a blazorise Anchor component. Added the relevant logs to the current changelog's optimization section. Updated the summary string documentation for the Virtualize Parameter of TreeView * formating * Mention default value * Fix virtualization * Add Virtualization example * Don't pass styling parameters further from root element * Use defaults when Virtualize is enabled * release notes * Change description * Docs notes * testing treeview virtualize with dynamic data * Properly fallback to default Height and Overflow values * Remove extra parenthesis * Fix duplicate nodes --------- Co-authored-by: ddjerqq <[email protected]> Co-authored-by: Mladen Macanovic <[email protected]> Co-authored-by: Mladen Macanovic <[email protected]> Co-authored-by: David Moreira <[email protected]>
- Loading branch information
1 parent
f279562
commit 9c88b10
Showing
12 changed files
with
630 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...Blazorise.Docs/Pages/Docs/Extensions/TreeView/Code/TreeViewVirtualizationExampleCode.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<div class="blazorise-codeblock"> | ||
<div class="html"><pre> | ||
<span class="htmlTagDelimiter"><</span><span class="htmlElementName">TreeView</span> <span class="htmlAttributeName">Nodes</span><span class="htmlOperator">=</span><span class="quot">"</span><span class="htmlAttributeValue">Items</span><span class="quot">"</span> | ||
<span class="htmlAttributeName">GetChildNodes</span><span class="htmlOperator">=</span><span class="quot">"</span><span class="htmlAttributeValue"><span class="atSign">@</span>(item => item.Children)</span><span class="quot">"</span> | ||
<span class="htmlAttributeName">HasChildNodes</span><span class="htmlOperator">=</span><span class="quot">"</span><span class="htmlAttributeValue"><span class="atSign">@</span>(item => item.Children?.Any() == true)</span><span class="quot">"</span> | ||
<span class="htmlAttributeName"><span class="atSign">@</span>bind-SelectedNode</span><span class="htmlOperator">=</span><span class="quot">"</span><span class="htmlAttributeValue">selectedNode</span><span class="quot">"</span> | ||
<span class="htmlAttributeName"><span class="atSign">@</span>bind-ExpandedNodes</span><span class="htmlOperator">=</span><span class="quot">"</span><span class="htmlAttributeValue">expandedNodes</span><span class="quot">"</span> | ||
<span class="htmlAttributeName">Virtualize</span><span class="htmlTagDelimiter">></span> | ||
<span class="htmlTagDelimiter"><</span><span class="htmlElementName">NodeContent</span><span class="htmlTagDelimiter">></span> | ||
<span class="htmlTagDelimiter"><</span><span class="htmlElementName">Icon</span> <span class="htmlAttributeName">Name</span><span class="htmlOperator">=</span><span class="quot">"</span><span class="enum">IconName</span><span class="enumValue">.Folder</span><span class="quot">"</span> <span class="htmlTagDelimiter">/></span> | ||
<span class="atSign">@</span>context.Text | ||
<span class="htmlTagDelimiter"></</span><span class="htmlElementName">NodeContent</span><span class="htmlTagDelimiter">></span> | ||
<span class="htmlTagDelimiter"></</span><span class="htmlElementName">TreeView</span><span class="htmlTagDelimiter">></span> | ||
</pre></div> | ||
<div class="csharp"><pre> | ||
<span class="atSign">@</span>code { | ||
<span class="keyword">public</span> <span class="keyword">class</span> Item | ||
{ | ||
<span class="keyword">public</span> <span class="keyword">string</span> Text { <span class="keyword">get</span>; <span class="keyword">set</span>; } | ||
<span class="keyword">public</span> IEnumerable<Item> Children { <span class="keyword">get</span>; <span class="keyword">set</span>; } | ||
} | ||
|
||
<span class="keyword">protected</span> <span class="keyword">override</span> <span class="keyword">void</span> OnInitialized() | ||
{ | ||
Items = Enumerable.Range( <span class="number">1</span>, <span class="number">4</span> ).Select( rootIndex => <span class="keyword">new</span> Item | ||
{ | ||
Text = $<span class="string">"Root Node {rootIndex}"</span>, | ||
Children = Enumerable.Range( <span class="number">1</span>, <span class="number">100</span> ).Select( childIndex => <span class="keyword">new</span> Item | ||
{ | ||
Text = $<span class="string">"Root {rootIndex} - Child {childIndex}"</span>, | ||
Children = Enumerable.Empty<Item>() <span class="comment">// No children for the child nodes in this example</span> | ||
} ) | ||
} ).ToList(); | ||
|
||
<span class="keyword">base</span>.OnInitialized(); | ||
} | ||
|
||
IEnumerable<Item> Items; | ||
|
||
IList<Item> expandedNodes = <span class="keyword">new</span> List<Item>(); | ||
Item selectedNode; | ||
} | ||
</pre></div> | ||
</div> |
41 changes: 41 additions & 0 deletions
41
...lazorise.Docs/Pages/Docs/Extensions/TreeView/Examples/TreeViewVirtualizationExample.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
@namespace Blazorise.Docs.Docs.Examples | ||
|
||
<TreeView Nodes="Items" | ||
GetChildNodes="@(item => item.Children)" | ||
HasChildNodes="@(item => item.Children?.Any() == true)" | ||
@bind-SelectedNode="selectedNode" | ||
@bind-ExpandedNodes="expandedNodes" | ||
Virtualize> | ||
<NodeContent> | ||
<Icon Name="IconName.Folder" /> | ||
@context.Text | ||
</NodeContent> | ||
</TreeView> | ||
|
||
@code { | ||
public class Item | ||
{ | ||
public string Text { get; set; } | ||
public IEnumerable<Item> Children { get; set; } | ||
} | ||
|
||
protected override void OnInitialized() | ||
{ | ||
Items = Enumerable.Range( 1, 4 ).Select( rootIndex => new Item | ||
{ | ||
Text = $"Root Node {rootIndex}", | ||
Children = Enumerable.Range( 1, 100 ).Select( childIndex => new Item | ||
{ | ||
Text = $"Root {rootIndex} - Child {childIndex}", | ||
Children = Enumerable.Empty<Item>() // No children for the child nodes in this example | ||
} ) | ||
} ).ToList(); | ||
|
||
base.OnInitialized(); | ||
} | ||
|
||
IEnumerable<Item> Items; | ||
|
||
IList<Item> expandedNodes = new List<Item>(); | ||
Item selectedNode; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.