Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'dhtmlx-gantt' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
initGanttDataProcessor() {
/**
* type: "task"|"link"
* action: "create"|"update"|"delete"
* item: data object object
*/
const onDataUpdated = this.props.onDataUpdated;
this.dataProcessor = gantt.createDataProcessor((type, action, item, id) => {
return new Promise((resolve, reject) => {
if (onDataUpdated) {
onDataUpdated(type, action, item, id);
}
// if onDataUpdated changes returns a permanent id of the created item, you can return it from here so dhtmlxGantt could apply it
// resolve({id: databaseId});
return resolve();
});
});
}
componentDidMount() {
gantt.config.xml_date = "%Y-%m-%d %H:%i";
const { tasks } = this.props;
gantt.init(this.ganttContainer);
this.initGanttDataProcessor();
gantt.parse(tasks);
}
componentDidMount() {
gantt.config.xml_date = "%Y-%m-%d %H:%i";
const { tasks } = this.props;
gantt.init(this.ganttContainer);
this.initGanttDataProcessor();
gantt.parse(tasks);
}
componentDidMount() {
gantt.config.xml_date = "%Y-%m-%d %H:%i";
const { tasks } = this.props;
gantt.init(this.ganttContainer);
this.initGanttDataProcessor();
gantt.parse(tasks);
}
setZoom(value) {
switch (value) {
case 'Hours':
gantt.config.scale_unit = 'day';
gantt.config.date_scale = '%d %M';
gantt.config.scale_height = 60;
gantt.config.min_column_width = 30;
gantt.config.subscales = [
{ unit: 'hour', step: 1, date: '%H' }
];
break;
case 'Days':
gantt.config.min_column_width = 70;
gantt.config.scale_unit = 'week';
gantt.config.date_scale = '#%W';
gantt.config.subscales = [
{ unit: 'day', step: 1, date: '%d %M' }
];
gantt.config.scale_height = 60;
switch (value) {
case 'Hours':
gantt.config.scale_unit = 'day';
gantt.config.date_scale = '%d %M';
gantt.config.scale_height = 60;
gantt.config.min_column_width = 30;
gantt.config.subscales = [
{ unit: 'hour', step: 1, date: '%H' }
];
break;
case 'Days':
gantt.config.min_column_width = 70;
gantt.config.scale_unit = 'week';
gantt.config.date_scale = '#%W';
gantt.config.subscales = [
{ unit: 'day', step: 1, date: '%d %M' }
];
gantt.config.scale_height = 60;
break;
case 'Months':
gantt.config.min_column_width = 70;
gantt.config.scale_unit = 'month';
gantt.config.date_scale = '%F';
gantt.config.scale_height = 60;
gantt.config.subscales = [
{ unit: 'week', step: 1, date: '#%W' }
];
break;
default:
break;
}
setZoom(value) {
switch (value) {
case 'Hours':
gantt.config.scale_unit = 'day';
gantt.config.date_scale = '%d %M';
gantt.config.scale_height = 60;
gantt.config.min_column_width = 30;
gantt.config.subscales = [
{ unit: 'hour', step: 1, date: '%H' }
];
break;
case 'Days':
gantt.config.min_column_width = 70;
gantt.config.scale_unit = 'week';
gantt.config.date_scale = '#%W';
gantt.config.subscales = [
{ unit: 'day', step: 1, date: '%d %M' }
];
gantt.config.scale_height = 60;
break;
case 'Months':
gantt.config.min_column_width = 70;
setZoom(value) {
switch (value) {
case 'Hours':
gantt.config.scale_unit = 'day';
gantt.config.date_scale = '%d %M';
gantt.config.scale_height = 60;
gantt.config.min_column_width = 30;
gantt.config.subscales = [
{ unit: 'hour', step: 1, date: '%H' }
];
break;
case 'Days':
gantt.config.min_column_width = 70;
gantt.config.scale_unit = 'week';
gantt.config.date_scale = '#%W';
gantt.config.subscales = [
{ unit: 'day', step: 1, date: '%d %M' }
];
gantt.config.scale_height = 60;
break;
case 'Months':
gantt.config.min_column_width = 70;
gantt.config.scale_unit = 'month';
gantt.config.subscales = [
{ unit: 'hour', step: 1, date: '%H' }
];
break;
case 'Days':
gantt.config.min_column_width = 70;
gantt.config.scale_unit = 'week';
gantt.config.date_scale = '#%W';
gantt.config.subscales = [
{ unit: 'day', step: 1, date: '%d %M' }
];
gantt.config.scale_height = 60;
break;
case 'Months':
gantt.config.min_column_width = 70;
gantt.config.scale_unit = 'month';
gantt.config.date_scale = '%F';
gantt.config.scale_height = 60;
gantt.config.subscales = [
{ unit: 'week', step: 1, date: '#%W' }
];
break;
default:
break;
}
}
setZoom(value) {
switch (value) {
case 'Hours':
gantt.config.scale_unit = 'day';
gantt.config.date_scale = '%d %M';
gantt.config.scale_height = 60;
gantt.config.min_column_width = 30;
gantt.config.subscales = [
{ unit: 'hour', step: 1, date: '%H' }
];
break;
case 'Days':
gantt.config.min_column_width = 70;
gantt.config.scale_unit = 'week';
gantt.config.date_scale = '#%W';
gantt.config.subscales = [
{ unit: 'day', step: 1, date: '%d %M' }
];
gantt.config.scale_height = 60;
break;