Hi,
I downloaded a source from the site and changed it as follows. I put a NavUrl for the treeview node. When the user clicks on the NodeText the NavigateUrl works correctly but when the user clicks on the treeview node icon the NavigateUrl does not work. I want the NavigateUrl to work properly by clicking on the icon.
<SfTreeView TValue="TreeItem" SortOrder="Syncfusion.Blazor.Navigations.SortOrder.Ascending">
<TreeViewFieldsSettings DataSource="@TreeDataSource" Id="NodeId" Text="NodeText" Expanded="Expanded" Child="@("Child")" IconCss="Icon" ImageUrl="ImageUrl" NavigateUrl="NavURL"></TreeViewFieldsSettings>
</SfTreeView>
TreeDataSource.Add(new TreeItem
{
NodeId = "03",
NodeText = "Documents",
Icon = "folder",
Child = new List<TreeItem>()
{
new TreeItem { NodeId = "03-01", NodeText = "Environment Pollution.docx", Icon = "docx",NavURL="/" },
new TreeItem { NodeId = "03-02", NodeText = "Global Water, Sanitation, & Hygiene.docx", Icon = "docx" },
new TreeItem { NodeId = "03-03", NodeText = "Global Warming.ppt", Icon = "ppt" },
new TreeItem { NodeId = "03-04", NodeText = "Social Network.pdf", Icon = "pdf" },
new TreeItem { NodeId = "03-05", NodeText = "Youth Empowerment.pdf", Icon = "pdf" },
},
});
Thank you
Hi Sarah,
Greetings from Syncfusion support.
We have validated your requirement in the Blazor TreeView component by preparing the sample. We understood that you want to perform page navigation in TreeView node icon selection. In TreeView, we have NavigateUrl property to perform page navigation. To set the entire tree node as navigable, you can use the FullRowNavigable property. If this property is set to true, then the entire TreeView node will be navigate-able instead of text element.
Refer to the below code snippet.
|
[MainLayout.razor]
<SfTreeView TValue="TreeItem" FullRowNavigable="true" SortOrder="@Syncfusion.Blazor.Navigations.SortOrder.Ascending" ShowCheckBox="true" AutoCheck="false" @ref="tree"> <TreeViewEvents TValue="TreeItem" NodeChecking="BeforeCheck"></TreeViewEvents> <TreeViewFieldsSettings DataSource="@TreeDataSource" NavigateUrl="NavigateUrl" Id="NodeId" Text="NodeText" Expanded="Expanded" Child="Child" IconCss="Icon"></TreeViewFieldsSettings> </SfTreeView>
@code{ … protected override void OnInitialized() { base.OnInitialized(); TreeDataSource.Add(new TreeItem { NodeId = "01", NodeText = "Music", Icon = "folder", NavigateUrl = "/FetchData", Child = new List<TreeItem>() { new TreeItem { NodeId = "01-01", NodeText = "Gouttes.mp3", Icon = "audio" } }, }); TreeDataSource.Add(new TreeItem { NodeId = "02", NodeText = "Videos", Icon = "folder", NavigateUrl = "/Counter", Child = new List<TreeItem>() { new TreeItem { NodeId = "02-01", NodeText = "Naturals.mp4", Icon = "video" }, new TreeItem { NodeId = "02-02", NodeText = "Wild.mpeg", Icon = "video" }, }, }); } } |
For your reference, we have attached the sample.
Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorTreeView491288867.zip
Please check the sample and let us know if you need any further assistance.
Regards,
Prasanth Madhaiyan.
Hi Prasanth Madhaiyan,
Thank you for the answer with full details.
Hi Sarah,
We are glad that the reported issue has been resolved. Please get back to us if you need any further assistance.
Regards,
Indhumathy L
Hi,
I used the following link in the treeview and considering that I used NodeClicked to open the corresponding page and I used NodeSelecting according to the link, it no longer works properly.
https://blazor.syncfusion.com/documentation/treeview/how-to/accordion-tree
2- How can I implement the following image?
blazor web app .net 8
Hi Sarah,
This query was branched to new forum. You can track the details related to new query on the link below.
https://www.syncfusion.com/forums/195604/treeview-navigateurl-from-176025
Regards,
Prasanth Madhaiyan.