Drag and drop between two trees with ContextMenu

Hi Sowmiya,

Thank you for your solution Thread ID:155455 Drag and drop between two trees for v18.3.0.51 can be work.

My requirement is to Drag and drop between two trees with SplitterPanes and then add the  SfContextMenu to the TreeView node .

But if I put reference to Thread ID:158575 for ContextMenu component) sample code and add code  SelectedNodes="@selectedNodes.ToArray()" to execute together, it will show error as below :



however, if execute Thread ID:158575 sample code independently will be work.

please advise if there is any restriction for SelectedNodes="@selectedNodes.ToArray()" of TreeView ?

Best regards,

Jacky



9 Replies 1 reply marked as answer

SP Sowmiya Padmanaban Syncfusion Team December 1, 2020 09:14 AM UTC

Hi Jacky,  
 
Greetings from Syncfusion support. 
 
We have checked your reported query with TreeView component. In TreeView, we have provided a two way binding support for selectedNodes property in the release version (18.3.41) 
 
Please, refer the below release notes. 
 
 
To resolve your issue, you need bind the selectedNodes property as per the below code snippet in your application. 
 
<SfTreeView TValue="EmployeeData" @ref="tree" AllowDragAndDrop="true" @bind-SelectedNodes="@selectedNodes"> 
                            <TreeViewFieldsSettings Id="Id" ParentID="Pid" DataSource="@ListData" Text="Name" HasChildren="HasChild"></TreeViewFieldsSettings> 
                            <TreeViewEvents TValue="EmployeeData" NodeSelected="OnSelect" NodeClicked="nodeClicked"></TreeViewEvents> 
                            <SfContextMenu TValue="MenuItem" @ref="menu" Target="#treeview" Items="@MenuItems"> 
                                <MenuEvents TValue="MenuItem" ItemSelected="MenuSelect"></MenuEvents> 
                            </SfContextMenu> 
                        </SfTreeView> 
 
public string[] selectedNodes { get; set; } 
// Triggers when TreeView node is clicked 
    public void nodeClicked(NodeClickEventArgs args) 
    { 
        selectedId = args.NodeData.Id; 
        selectedNodes = new string[] { selectedId }; 
    } 
 
For your reference, we have prepared a sample for TreeView with context menu. Please, refer the sample link below. 
 
 
If the issue still persist, please replicate the issue in attached sample. It would help us to provide you prompt solution. 
 
Please let us know, if you need any further assistance. 
 
Regards,  
Sowmiya.P 


Marked as answer

JA Jacky December 2, 2020 06:58 AM UTC

Hi Sowamiya, 

Thank you so much again for your quick reply and provide the sample code which really helps me a lot.

Have a very nice day !


Best regards,
Jacky


SP Sowmiya Padmanaban Syncfusion Team December 2, 2020 07:06 AM UTC

Hi Jacky,  
  
Most Welcome. We are happy to hear that your problem has been resolved. Please contact us, if you need any help from us. 
  
Regards,  
  
Sowmiya.P 



JA Jacky February 26, 2022 11:56 AM UTC

Hi Sowamiya, 


I  upgrade to the sample project as attach file to  .net 5 && Syncfusion.Blazor 19.4.0.53, the  SfContextMenu seems not work.

please advise if is there  any restriction for this?


Best regards,

Jacky


Attachment: TreeView1855732381v194053_116b8412.zip


GK Gayathri KarunaiAnandam Syncfusion Team February 28, 2022 04:27 PM UTC

Hi Daniel, 

We are sorry for the inconvenience. The issue is due to some technical glitches at our end. We will resolve this in our upcoming patch release which is scheduled for March 2nd,2022. Please use the below custom package until then. 
                

Regards, 
Gayathri K 



JA Jacky March 1, 2022 01:52 PM UTC

Hi  Gayathri  ,


Thank for your reply , waiting for  patch release .


Regards!

Jacky



GK Gayathri KarunaiAnandam Syncfusion Team March 2, 2022 05:26 AM UTC

Hi Jacky, 
 
We are glad to announce that our weekly patch release (19.4.0.54) is rolled out. We have included the fix for this issue in this release. So, we suggest you upgrade our Syncfusion packages to our latest version to resolve this issue in your end. 
 
 
Please check and get back to us, if you need further assistance. 
 
Regards, 
Gayathri K 



JA Jacky March 2, 2022 11:19 AM UTC

Hi  Gayathri ,


After  upgrade the  Syncfusion packages, it's works , thank again.


Best Regards!

Jacky



GK Gayathri KarunaiAnandam Syncfusion Team March 4, 2022 03:34 AM UTC

Hi Jacky, 
  
You are most welcome. 
  
We are happy to hear that your issue has been resolved. Please feel free to contact us if you need any further assistance on this. 
 
Regards, 
Gayathri K 


Loader.
Up arrow icon