Collapse All fails when adding a row

I click a button and call this code, which adds a row to the treegrid, then I call collapse all and it crashes. is there something I need to do to refresh the state of the treegrid before I call collapseall?

    let category = new Category();
    category.isParent = true;
    category.text = "Test"
    this.dataLoadService.data.categories.unshift(category);
    let child = new Category();
    child.text = "hello";
    //category.children=[child]
    this.treegrid.refresh();
    this.treegrid.collapseAll();

file: ej2-treegrid.es2015.js

Line 5353


this.uniqueIDCollection does not have any values matching record.uniqueID and the grid crashes when collapseall is called.

                if (!isChild || isCountRequired(this)) {
                    record.expanded = false;
                    this.uniqueIDCollection[record.uniqueID].expanded = record.expanded;
                }

3 Replies 1 reply marked as answer

PS Pon Selva Jeganathan Syncfusion Team September 22, 2021 12:22 PM UTC

Hi Zachary 
   
Thanks for contacting syncfusion forum. 
 

Query: Collapse All fails when adding a row

 
We checked your query by preparing sample based on your code snippet, but We are unable to reproduce the issue at our end.   
 
Please refer to the below sample, 
 
Please refer to the below video demo. 
 

After following the above reference, still faced issue please share us the following details.


  1. Share the product detail version.
  2. Share the Tree Grid rendering code example.
  3. Share the screenshot of stacktrace details(face if any)
  4. If possible, reproduce the issue in the attached sample or share the issue reproducible sample.
  5. Share the video demo of the issue.
 
The provided information will be helpful to provide you response as early as possible.   
  
Regards, 
Pon selva 
 


Marked as answer

ZA Zachary September 22, 2021 06:06 PM UTC

Thanks Pon,


I worked around it so I should be ok, but I figured I would ask in case I was missing something major.


-Zack



PS Pon Selva Jeganathan Syncfusion Team September 23, 2021 11:33 AM UTC

Hi Zachary 
 
Thanks for the update. 
 
We are glad to hear your query has been solved. 
 
Kindly get back to us for further assistance. We are happy to assist you. 
 
   
Regards, 
Pon selva 


Loader.
Up arrow icon