We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Expand without selection

Thread ID:





149235 Nov 19,2019 06:09 PM UTC Nov 21,2019 04:05 AM UTC ASP.NET Core - EJ 2 3
Tags: Tree Grid
Patrick King
Asked On November 19, 2019 06:09 PM UTC

I'm sure I've simply missed something in the documentation and Demo.  If I have 'rowSelected' event defined on the treegrid, if I click on the expand icon, the rowSelected event is triggered.  Is there a way to not select the row if the expand icon has been clicked?

<ejs-treegrid id="TreeGrid1" dataSource="@ViewBag.datasource1" idMapping="O6CNT" parentIdMapping='O6PRNT' enableCollapseAll="true" treeColumnIndex="0" allowSelection="true" rowSelected="rowselected">
    <e-treegrid-selectionsettings mode="Row"></e-treegrid-selectionsettings>
        <e-treegrid-column field="O6ORDNUM" headerText="Ord #" textAlign="Right" width="20"></e-treegrid-column>
        <e-treegrid-column field="O6ITEM" headerText="Item#" width="20">></e-treegrid-column>
        <e-treegrid-column field="ODPN" headerText="Part" width="20">></e-treegrid-column>
        <e-treegrid-column field="ODTEXT" headerText="Description" width="60"></e-treegrid-column>

Rajapandi Ravi [Syncfusion]
Replied On November 20, 2019 01:16 PM UTC

Hi Patrick, 

Thanks for using syncfusion support. 

Query#: Is there a way to not select the row if the expand icon has been clicked? 
Yes, We have achieved your requirement by using rowSelecting event. This event gets fired before the rowSelected event, So here we have prevent the selection based on the target. Please refer the below code example for more information. 

<ejs-treegrid id="tree1" rowSelecting="rowselecting" allowPaging="true" dataSource="@ViewBag.datasource" idMapping="TaskId" parentIdMapping="ParentId" treeColumnIndex="0" > 
            .  .  .  .  .  .  . 
            .  .  .  .  .  .  . 
    function rowselecting(args) { 
        if (args.target.classList.contains("e-treegridexpand")) { 
           args.cancel = true;            // It helps to not triggering the rowselected event 

Rajapandi R

Patrick King
Replied On November 20, 2019 09:19 PM UTC

Thanks so much for the quick response.  This worked perfectly.  I did add e-treegridcollapse to the condition and my rowselected function only processed when not expanding or collapsing the grid.

Padmavathy Kamalanathan [Syncfusion]
Replied On November 21, 2019 04:05 AM UTC

Hi Patrick,

Thanks for your update. We are happy to hear that your issue has been resolved.

Feel free to get back to us if you need further assistance.

Padmavathy Kamalanathan


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon