NodeTemplate with a button prevent the button from click ?

    <SfTreeView TValue="TreeData" ShowCheckBox="true" SortOrder="Syncfusion.Blazor.Navigations.SortOrder.None">
        <TreeViewFieldsSettings DataSource="@TreeDataSource" Id="Id" ParentID="Pid" Text="Name" HasChildren="HasChild" Expanded="Expanded" Selected="IsSelected" ></TreeViewFieldsSettings>
        <TreeViewTemplates>
            <NodeTemplate>
                <button @onclick="onClick">test</button>
            </NodeTemplate>
            </TreeViewTemplates>
    </SfTreeView>

- Any item with click event handler inside the NodeTemplate will not trigger the event handler.
How can I trigger click even handler on objects inside the NodeTemplate of TreeView ?

3 Replies 1 reply marked as answer

SP Sowmiya Padmanaban Syncfusion Team June 19, 2020 10:05 AM UTC

Hi Yordon, 
 
Greetings from Syncfusion support. 
 
We have checked your reported problem that click events bound for icon inside the node template of TreeView component is not triggered when clicking on it. By default, we have prevented the pointer events for node template elements of TreeView. By setting the pointer-events as auto for TreeView node element, you can be able to trigger the events bound to the node template elements inside tree nodes of TreeView. 
 
<style> 
    .e-treeview.e-fullrow-wrap .e-text-content { 
      pointer-events: auto; 
    } 
 
</style> 
 
Refer the below sample link. 
 
 
To know more about the TreeView component. Refer the below links. 
 
 
 
 
Please let us know, if you need any further assistance. 
 
Regards,  
Sowmiya.P 


Marked as answer

YO Yordan June 23, 2020 10:30 AM UTC

Awesome! Worked !
Thank You Sowmiya Padmanaban [Syncfusion] !


SP Sowmiya Padmanaban Syncfusion Team June 23, 2020 02:21 PM UTC

Hi Yordon, 
  
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 


Loader.
Up arrow icon