Control disabled

I have a problem I can't understand.  I can run sample code in Vs2019 and the treeviews act normally , expanding and contracting and firing Click events.  When I cut and paste the same code into VS2022 the treeview will display nodes but will not act dynamically.

I've tried various solutions but am at my wits end.  


Thanks


Simon


@using Syncfusion.Blazor.Lists

@using Syncfusion.Blazor.Navigations

<div id="treeparent">

    <SfTreeView TValue="MailItem" @ref="tree2">

        <TreeViewEvents TValue="MailItem" NodeSelected="nodeSelect"></TreeViewEvents>

        <TreeViewFieldsSettings TValue="MailItem" Id="Id" DataSource="@MyFolder" Text="FolderName" ParentID="ParentId" HasChildren="HasSubFolders" Expanded="Expanded"></TreeViewFieldsSettings>

    </SfTreeView>

</div>



@code {

    public class MailItem

    {

        public string Id { get; set; }

        public string ParentId { get; set; }

        public string FolderName { get; set; }

        public bool Expanded { get; set; }

        public bool HasSubFolders { get; set; }

    }

    List<MailItem> MyFolder = new List<MailItem>();

    SfTreeView<MailItem> tree2;


// usual OnInitialised and tree items


    public void nodeSelect(NodeSelectEventArgs e)

    {

        var target = e.NodeData.Id;

    }


Nodes do not expand nor collapse and nodeSelect does not fire


1 Reply 1 reply marked as answer

SS Sivakumar ShunmugaSundaram Syncfusion Team September 22, 2022 11:56 AM UTC

Hi simon,


As per the shared details, we understand that you are facing an issue while implementing the Blazor TreeView component in VS 2022, which will not act dynamically. We have prepared a simple sample of the Blazor TreeView component in VS 2022, and the sample works fine with interaction and triggers the NodeSelected event.


We suspect that the issue is due to a missing script reference in the _Layout.cshtml file in your application. To overcome the issue, we suggest you set the proper script reference in your application. We have attached the prepared sample for your reference.


Refer to the below code snippet.

[_Layout.cshtml]

 

<link rel='nofollow' href= https://cdn.syncfusion.com/blazor/20.2.50/styles/bootstrap5.css rel="stylesheet"/>

<script src= https://cdn.syncfusion.com/blazor/20.2.50/syncfusion-blazor.min.js type="text/javascript"></script>


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorApp12002184867.zip


Please check the attached sample and get back to us if you need any further assistance.


Regards,

Sivakumar S


Marked as answer
Loader.
Up arrow icon