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

expandAtLevel

Hi,

is there any similar function to expandAtLevel from Grid?
Curently I have the following part of function, which expand records to number level and colapse others:
for(let item of args.model.flatRecords){
if((item.level < number && !item.expanded) || (item.level == number && item.expanded))
ganttObj.expandCollapseRecord(item.taskId);
}
and this works OK, but it becom slow, when I have 500+ records in my Gantt.
So is there any better way?

Regards,
Marko


1 Reply

SR Suriyaprasanth Ravikumar Syncfusion Team August 28, 2017 11:35 AM UTC

Hi Marko, 
Please find the response below. 
Query 1: is there any similar function to expandAtLevel from Grid? 
Answer: At present, there is no method available to expand/collapse the record at specific level in Gantt. For this we have already logged a feature report as” Public method support to expand/collapse records at specific level”. This feature will be included in our upcoming volume 4, 2017 main release which will be expected to out at end of October, 2017. 
 
Query 2: but it become slow, when I have 500+ records in my Gantt. 
Answer: We can overcome this performance delay by enabling virtualization support in Gantt. We can enable this by set “enbleVirtualization” property as true. 
As per your requirement we have prepared a sample and reduced the time delay on expand/collapse action. 
We have achieved by using “enableVirtualization” property and by preventing the unwanted execution of “expandCollapseRecord” public method by checking whether it contains child records or not. 
Please refer the following code snippet. 
[HTML] 
<ej-gantt id="GanttControl" [dataSource]="datasource" [enableVirtualization]="true" 
            //... 
> 
</ej-gantt> 
<button (click)="expandCollapse(1)">Expand/Collapse</button> 
 
[TS] 
    public expandCollapse(Number?: number) { 
        var ganttObj = $("#GanttControl").ejGantt('instance'); 
        for(let item of ganttObj.model.flatRecords){ 
            if (item.hasChildRecords && ((item.level < Number && !ganttObj.getExpandStatus(item)) || (item.level == Number && ganttObj.getExpandStatus(item)))) 
                ganttObj.expandCollapseRecord(item.taskId); 
        } 
    } 
Please find the sample from below location. 
Please let us know if you require further assistance on this. 
Thanks, 
Suriyaprasanth R.

Loader.
Live Chat Icon For mobile
Up arrow icon