Getting errors when updating syncfusion package getting error in treeview node click event

The errors and warnings are represented in bold

        protected async Task TreeNodeClick(NodeKeyPressEventArgs args)
        {
            string Key = args.Event.Key;
            if (Key == "Enter" && !ExpandIconClick)
            {
                NodeDetails = await this.tree.GetTreeData(args.Node); // Argument 1: cannot convert from 'Syncfusion.Blazor.DOM' to 'string?'
                var Element = new[] { args.Node };  // NodeKeyPressEventArgs.Node is Obsolete
                bool check = NodeDetails[0]?.IsSelected ?? false;
                if (check)
                {
                    await this.tree.UncheckAll(Element);  // No overload for method 'UncheckAll' takes 1 arguments
                }
                else
                {
                    await this.tree.CheckAll(Element); //  // No overload for method 'CheckAll' takes 1 arguments
                }
            }
            ExpandIconClick = false;
        }

List treeData = await tree.GetTreeData(args.Data[0].Id); //  'NodeCheckEventArgs' does not contain a definition for 'Data' and no accessible extension method 'Data' accepting a first argument of type 'NodeCheckEventArgs' could be found (are you missing a using directive or an assembly reference?)

2 Replies 1 reply marked as answer

SP Sowmiya Padmanaban Syncfusion Team October 13, 2020 12:30 PM UTC

Hi Richy,  
 
Greetings from Syncfusion support. 
 
Query1 – Issue in OnKeyPress event 
 
Based on your shared code, we have identified  that you are using OnKeyPress event for TreeView component. We have included some changes in our latest version of TreeView component. 
 
Refer the release notes below to know about the changes moved with the latest release. 
 
 
We have passed the NodeData in OnKeyPress event. Using that data, you can achieve your requirement. Refer the below code snippet. 
 
  public async Task keyPress(Syncfusion.Blazor.Navigations.NodeKeyPressEventArgs args) 
    {   
        var NodeDetails = this.tree.GetTreeData(args.NodeData.Id); 
        var Element = new string[] { args.NodeData.Id };   
        bool check = NodeDetails[0]?.select ?? false; 
        if (check) 
        { 
            await this.tree.UncheckAll(Element);  
        } 
        else 
        { 
            await this.tree.CheckAll(Element);  
        }   
    } 
 
 
But in our latest version, key value will not be available in the event argument. We have logged this as a bug from our end. Fix for this issue will be included in our next patch release which is expected to be rolled out in third week of October 2020. 
 
You can track the following feedback portal link to the know status of this issue fix. 
 
 
Query 2-  'NodeCheckEventArgs' does not contain a definition for 'Data' and no accessible extension method 'Data' accepting a first argument of type 'NodeCheckEventArgs' could be found (are you missing a using directive or an assembly reference? 
 
You can fetch the nodeDetails of the corresponding node in event argument. Refer the below code snippet. 
 
<SfTreeView TValue="MailItem"  @ref="tree" ShowCheckBox="true"> 
    <TreeViewFieldsSettings TValue="MailItem" Id="Id" DataSource="@MyFolder" Text="FolderName" ParentID="ParentId" Selected="select" HasChildren="HasSubFolders" Expanded="Expanded"></TreeViewFieldsSettings> 
    <TreeViewEvents TValue="MailItem" OnKeyPress="keyPress" NodeChecked="nodeCheck"></TreeViewEvents> 
</SfTreeView> 
public void nodeCheck(Syncfusion.Blazor.Navigations.NodeCheckEventArgs args) 
    { 
        // checked node details. 
        var nodeDetails = args.NodeData; 
    } 
 
Please let us know, if you need any further assistance. 
 
Regards, 
Sowmiya.P 



MK Muthukrishnan Kandasamy Syncfusion Team October 20, 2020 09:38 AM UTC

 
Hi Richy, 
 
Thanks for being patience. 
 
We have fixed your reported problem in Blazor TreeView component. Now, we can able to get the key value in the keypress event. To resolve your reported problem, please update the (Syncfusion.Blazor) NuGet package into latest version (18.3.42). 
 
Please let us know, if you need any further assistance. 
 
Regards, 
Muthukrishnan K 


Marked as answer
Loader.
Up arrow icon