Our state of the art Gantt chart


Post by rahulranjan »

import { SechduleService } from './sechdule.service';
import { Component, OnInit, ElementRef } from '@angular/core';
import { Gantt, ProjectModel, Panel, WidgetHelper, CrudManager, Toast } from 'bryntum-gantt';
import ganttToolbar from './ganttToolbar';
import { Renderer2 } from '@angular/core';
import ganttConfig from './ganttConfig';
import Task from './Task.js';
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
  title = 'AngularBrytum';
  private elementRef: ElementRef;
  constructor(element: ElementRef, private service: SechduleService, private render: Renderer2) {
    this.elementRef = element;
  }

  async ngOnInit() {

    let info = await this.service.loadWbsData('BkO0wRXI4');

    const crudManager = new CrudManager({
      transport: {
        sync: {
          url: 'php/save.php'
        }
      }
    });
    crudManager.sync().
      // no load errors occurred
      then((response) => {
        console.log('Curd' + response);
      }).
      // loading failed
      catch(response => {
        // show notification with error message
        Toast.show(response && response.message || 'Unknown error occurred');
      });
    const project = new ProjectModel({
      tasksData: info.data.tasks.rows,
      resourcesData: info.data.resources.rows,
      assignmentsData: info.data.assignments.rows,
      dependenciesData: info.data.dependencies.rows,
      //eventModelClass: Task,
    });
      const gantt = new Gantt({
      project: project,
      ...ganttConfig,
     }),
      tbar = ganttToolbar(gantt)
    let config = {
      appendTo: this.elementRef.nativeElement.firstElementChild,
      widgets: [gantt],
      tbar,
      }
    };
    // panel renders to this component's element
    new Panel(config);
  }
}


Service Code to reterive 
[code]load() {
    const url = `project`;
    return this.httpClient.get<any>(url, )
      .toPromise();
  }
[/code]

I want to implement curd manager in this and task store , resource store etc. Can you please help me in it.

Post by mats »

The code you posted doesn't make much sense, you have a sync URL but no load URL. Recommended reading:

https://bryntum.com/docs/gantt/#guides/project_data.md
https://bryntum.com/docs/scheduler/#Sch ... rudManager

Post by rahulranjan »

Yes i know , i am loading the data from other source . But Anyway i will implement it. let you know

Post Reply