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

TreeGrid Search results not showing children

-- Update --
I found the issue. When I put this command inside the treegrid, EnableCollapseAll = "true" , it caused the undesired behavior. If I remove this, the grid works as expected.

--- Original ---
When doing a search which results in the parent and a child both containing the search criteria, the search results show two rows each showing only the parent. If you click on the expand arrow, the child never appears. For example:

Parent: {Id=1, Name=Charlie, Code=CHAR}
Child:  {Id=2, ParentId=1, Name=Charlie 1, Code=C1}

Search Criteria = char
Tested with  FilterHierarchyMode.Parent, Both, Child, and None.

    < EjsTreeGrid ID="TreeGrid" @ref="TreeGrid" DataSource="@TreeData" IdMapping="OrgUnitId" ParentIdMapping="ParentOrgUnitId" TreeColumnIndex="1"
                 AllowPaging="true" AllowExcelExport="true" AllowFiltering="true" AllowMultiSorting="true" AllowPdfExport="true"
                 AllowReordering="true" AllowResizing="true" AllowRowDragAndDrop="true" AllowSorting="true"
                 EnableAltRow="true" EnableCollapseAll="true" EnableHover="true" ShowColumnMenu="true"
                 Toolbar="@(new List() { "Search" })">

        < TreeGridSearchSettings Operator="Operator.Contains" Fields="@(new string[] { "Code", "Name", "LegalName" })"  HierarchyMode="FilterHierarchyMode.Both">

        < TreeGridEvents TValue="Node" RowSelected="RowSelectHandler" OnRecordDoubleClick="DoubleClicked">
        < TreeGridSelectionSettings Type="Syncfusion.EJ2.Blazor.Grids.SelectionType.Single" Mode="Syncfusion.EJ2.Blazor.Grids.SelectionMode.Row">
< /TreeGridSelectionSettings>
        < TreeGridPageSettings PageSizeMode="PageSizeMode.Root" PageSize="50">
        < TreeGridEditSettings AllowAdding="false" AllowEditing="false" AllowDeleting="false" Mode="Syncfusion.EJ2.Blazor.TreeGrid.EditMode.Row">
< /TreeGridEditSettings>
        < TreeGridFilterSettings Type="Syncfusion.EJ2.Blazor.TreeGrid.FilterType.Menu">
        < TreeGridColumns>
            < TreeGridColumn Field="Code" HeaderText="Code" Width="20">
            < TreeGridColumn Field="Name" HeaderText="Name" Width="40">
            < TreeGridColumn Field="LegalName" HeaderText="Legal Name" Width="40">
            < TreeGridColumn Field="ExternalCode" HeaderText="Ext. Code" Width="20">
        < /TreeGridColumns>
    < /EjsTreeGrid>

This shows the search applied. Search is on Code, Name, and Legal Name fields.  

This shows the tree grid without a search applied: 

3 Replies

SE Sathyanarayanamoorthy Eswararao Syncfusion Team January 22, 2020 07:32 AM

Hi Scott, 

Thanks for using Syncfusion products. 

Query: When doing a search which results in the parent and a child both containing the search criteria, the search results show two rows each showing only the parent. 
We were also able to reproduce the mentioned issue on our side. We have confirmed that the mentioned issue is a bug and have logged the bug report for the same. Thank you for taking the time to report this issue “Searching is not working properly if EnableCollapseAll is set as true” and helping us improve our product. Fix for the issue will be included in our Next Bi-Weekly Nuget release which is expected to be rolled out on or before 5th  February 2020. 

You can track the status of the issue by using the below feedback link   

Note: Kindly login to your account to view the feedback link. 

We appreciate your patience until then. 


MM Maurizio Meloni May 2, 2022 01:12 AM

Hello all,

i found the problem.

The expected value for the ParentIdMapping should be NULL if not have any parents.

I was using a default value of "-1" for every object without parent.. in this way they were not showed inside the tree grid.

now i changed the default value to null and now everythign work.

thank you very much!


MP Manivannan Padmanaban Syncfusion Team May 3, 2022 01:45 AM

Hi Maurizio,

As you mentioned, the ParentIdMapping value of the root node (i.e., the parent record) must be null. Because, according to tree grid architecture the ParentIdMapping null value records were considered as the root node.

Please let us know if you require any additional assistance. We will be happy to assist you.


Manivannan Padmanaban

Live Chat Icon For mobile
Up arrow icon