Premium support for our pure JavaScript UI components


Post by rahulranjan »

Hi
1. Select the gantt
2. Select the view from drop down
When i select the different views from drop down and load the gantt again and again based on selection(values come from DB)In this case it is json file . If the data is large then js heap size increases and at one point gantt stop responding.
Attachments
advanced-forum-test.rar
(1.3 MiB) Downloaded 103 times

Post by saki »

Try to destroy gantt at the beginning of getColumnsData:
    getColumnsData(value) {

        if(this.gantt) {
            this.gantt.destroy();
        }
        this.gantt = null;
Note: I was trying for a while to switch between views but it worked properly.

Post by rahulranjan »

Hi
When i do this a select view it keep on creating panels in screen

Post by saki »

Yes the gantt is created over and over in loadGantt method with this code:
            this.gantt = new Gantt({
                ...ganttConfig,
                project: this.project
            });
You must create it anew because you destroy its parent (this.panel.destroy()) in getColumnsData function:
    getColumnsData(value) {

        this.panel.destroy();
        this.project.eventStore.data = [];
        this.gantt = null;
        this.project = null;
        this.panel = null;
        this.loadGantt();
    }
Destroying and re-creating a component can be the valid approach in some cases, however, I would first try to reuse the existing component. The reuse could consist of loading new data, changing columns, etc. in an existing component without destroying and re-creating it.

Post Reply