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.