Request new features or modifications


Post by cds_cds_eb »

i was doing some tests and saw this happening a lot of times, if more information is needed, please let me know

Attachments
gantt bug.gif
gantt bug.gif (855.81 KiB) Viewed 8005 times

Post by marcio »

Hey cds_cds_eb,

Are you able to replicate that behavior on one of our demos? Or share a sample project with your configuration and a step-by-step to reproduce the issue that you're sharing.

Are you using the latest version of our Suite?

Check the guidelines here for more information viewtopic.php?f=1&t=772

Best regards,
Márcio


Post by cds_cds_eb »

i'm using v5.2.8.

the new Task button calls this function:

async onAddTaskClick() {
		const {gantt} = this;
		const added = gantt.taskStore.rootNode.appendChild({name: 'New task', duration: 1});

	// run propagation to calculate new task fields
	await gantt.project.propagateAsync();

	// scroll to the added task
	await gantt.scrollRowIntoView(added);

	gantt.features.cellEdit.startEditing({
		record: added,
		field: 'name'
	});
}

this is my gantt.config:

export class GanttConfig {

projectModel: MyProjectModel | null;

constructor(projectModel: MyProjectModel | null) {
	this.projectModel = projectModel;
}

public ganttConfig() {
	return {
		dependencyIdField: 'wbsCode',

		project: this.projectModelConfig(),

		startDate: this.projectModel ? this.projectModel.startDate : '',
		endDate:  this.projectModel ? this.projectModel.endDate : '',
		columns: [
			{ type: 'wbs' },
			{ type: 'name', width: 250 },
			{ type: 'startdate' },
			{ type: 'duration' },
			{ type: 'resourceassignment', width: 120, showAvatars: true },
			{ type: 'percentdone', showCircle: true, width: 70 },
			{ type: 'predecessor', width: 112 },
			{ type: 'successor', width: 112 },
			{ type: 'schedulingmodecolumn' },
			{ type: 'calendar' },
			{ type: 'constrainttype' },
			{ type: 'constraintdate' },
			{ type: 'addnew' }
		],

		subGridConfigs: {
			locked: {
				flex: 3
			},
			normal: {
				flex: 4
			}
		},

		columnLines: false,

		features: {
			pdfExport: {
				exportServer: environment.exportGanttServer
				// Required for font-awesome icons to display correctly,
			},
			excelExporter: {
				// Choose the date format for date fields
				dateFormat: 'YYYY-MM-DD HH:mm',
				zipcelx
			},
			rollups: true,
			baselines: {
				// Custom tooltip template for baselines
				template: (data) => this.getBaselineTooltipTemplate(data)

			},
			progressLine: {
				disabled: true,
				statusDate: this.projectModel?.statusDate
			},
			filter: true,
			dependencyEdit: true,
			timeRanges: {
				showCurrentTimeLine: true
			},
			labels: {
				left: {
					field: 'name',
					editor: {
						type: 'textfield'
					}
				}
			},
			cellEdit: {
				addNewAtEnd: false
			},
		},
		tbar: {
			type: 'gantttoolbar'
		}
	};
}

private getBaselineTooltipTemplate(data) {
	let me: any = this;
	let { baseline } = data;
	let { task } = baseline;
	let delayed = task.startDate > baseline.startDate;
	let overrun = task.durationMS > baseline.durationMS;
	let { decimalPrecision }: any = me;

	if (decimalPrecision == null) {
		decimalPrecision = me.client.durationDisplayPrecision;
	}

	let multiplier = Math.pow(10, decimalPrecision);
	let displayDuration = Math.round(baseline.duration * multiplier) / multiplier;

	return `
		<div class="b-gantt-task-title">${ StringHelper.encodeHtml(task.name) } (${ me.L('baseline') } ${ baseline.parentIndex + 1 })</div>
		<table>
		<tr><td>${ me.L('Start') }:</td><td>${ data.startClockHtml }</td></tr>
		${ baseline.milestone ? '' : `
			<tr><td>${ me.L('End') }:</td><td>${ data.endClockHtml }</td></tr>
			<tr><td>${ me.L('Duration') }:</td><td class="b-right">${ displayDuration + ' ' + DateHelper.getLocalizedNameOfUnit(baseline.durationUnit, baseline.duration !== 1) }</td></tr>
		` }
		</table>
		${ delayed ? `
			<h4 class="statusmessage b-baseline-delay"><i class="statusicon b-fa b-fa-exclamation-triangle"></i>${ me.L('Delayed start by') } ${ DateHelper.formatDelta(task.startDate - baseline.startDate) }</h4>
		` : '' }
		${ overrun ? `
			<h4 class="statusmessage b-baseline-overrun"><i class="statusicon b-fa b-fa-exclamation-triangle"></i>${ me.L('Overrun by') } ${ DateHelper.formatDelta(task.durationMS - baseline.durationMS) }</h4>
		` : '' }
	`;
}

private projectModelConfig(): object {
	const idProjeto: number = this.projectModel ? this.projectModel.id : 1;

	return {
		taskModelClass: Task,
		transport: {
			load: {
				url: 'php/load.php',
				paramName: 'q',
				params: {
					projetoId: idProjeto
				}
			},
			sync: {
				url: 'php/sync.php',
				params: {
					projetoId: idProjeto
				}
			}
		},
		autoLoad: true,
		autoSync: true,
		direction: this.projectModel?.direction,
		stm: {
			autoRecord: true
		},
		validateResponse: true,

		onBeforeLoad(event): boolean {
			BryntumLoadSyncUtil.addLoadParams(event.pack, 'gantt');
			return true;
		}
	};
};

}

this only happens in my production environment, when i'm runing the project locally this doesn't happen
i thought it may be something related to the slow connection, but theres nothing wrong with the sync request ( at least nothing that i can put my finger on)


Post by alex.l »

Hi,

Actually, we should be able to reproduce that to help you fast and see what's the problem in. But I will try to guess.
Will that happen if you remove this part

	gantt.features.cellEdit.startEditing({
		record: added,
		field: 'name'
	});

Could you please make sure added record is exists in your store after your server returned a response with id for new task?

All the best,
Alex


Post by cds_cds_eb »

Removing the code block didn't work


Post by alex.l »

Ok, please post response and request JSON for load and sync operations.

when i'm runing the project locally this doesn't happen

very possible there is something with id/$phantomId in server response, but I don't know exactly, because I don't see this problem in our demos.
You can read about response structure here https://bryntum.com/products/gantt/docs/guide/Gantt/data/crud_manager

All the best,
Alex


Post by cds_cds_eb »

i'm gonna attach a video so you can see the order of the sync request
Load response (this is a new project) :

{
        "success": true,
        "requestId": 16814850749350,
        "project": {
            "calendar": "191",
            "name": "teste bryntum",
            "startDate": "2023-04-14 00:00:00-03:00",
            "endDate": "2023-04-14 00:00:00-03:00",
            "hoursPerDay": "24",
            "daysPerMonth": "20",
            "daysPerWeek": "5"
        },
        "calendars": {"rows": []},
        "resources": {"rows": []},
        "assignments": {"rows": []},
        "dependencies": {"rows": []},
        "tasks": {"rows": []},
        "timeRanges": {
            "rows": [{
                "id": "1",
                "RESOURCE_ID": null,
                "name": "Important date",
                "startDate": "2019-01-30 00:00:00-02:00",
                "endDate": null,
                "RECURRENCE_RULE": null,
                "cls": "b-fa b-fa-diamond"
            }]
        },
        "revision": 1297
    }

first sync payload :

{
        "type": "sync",
        "requestId": 16814855051771,
        "revision": 1327,
        "tasks": {
            "added": [
                {
                    "parentIndex": 1,
                    "startDate": "2023-04-14T00:00:00-03:00",
                    "endDate": "2023-04-15T00:00:00-03:00",
                    "duration": 1,
                    "durationUnit": "day",
                    "cls": "",
                    "name": "New task",
                    "calendar": null,
                    "direction": "Forward",
                    "manuallyScheduled": false,
                    "unscheduled": false,
                    "ignoreResourceCalendar": null,
                    "constraintType": null,
                    "constraintDate": null,
                    "inactive": null,
                    "percentDone": 0,
                    "segments": null,
                    "effort": 24,
                    "effortUnit": "hour",
                    "effortDriven": false,
                    "schedulingMode": "Normal",
                    "baselines": [],
                    "parentId": null,
                    "$PhantomId": "_generatedt_e74c314e-c5ef-4a9f-8975-ccdaf349f296"
                }
            ]
        }
    }

first sync response :

{
    "success": true,
    "requestId": 16814855051771,
    "tasks": {
        "rows": [
            {
                "$PhantomId": "_generatedt_e74c314e-c5ef-4a9f-8975-ccdaf349f296",
                "id": "10273"
            }
        ]
    },
    "revision": 1328
}

second sync payload :

{
    "type": "sync",
    "requestId": 16814855080732,
    "revision": 1328,
    "tasks": {
        "added": [
            {
                "parentIndex": 2,
                "startDate": "2023-04-14T00:00:00-03:00",
                "endDate": "2023-04-15T00:00:00-03:00",
                "duration": 1,
                "durationUnit": "day",
                "cls": "",
                "name": "New task",
                "calendar": null,
                "direction": "Forward",
                "manuallyScheduled": false,
                "unscheduled": false,
                "ignoreResourceCalendar": null,
                "constraintType": null,
                "constraintDate": null,
                "inactive": null,
                "percentDone": 0,
                "segments": null,
                "effort": 24,
                "effortUnit": "hour",
                "effortDriven": false,
                "schedulingMode": "Normal",
                "baselines": [],
                "parentId": null,
                "$PhantomId": "_generatedt_e21f9c6f-7f19-4a63-aab6-0b91b17f7399"
            }
        ]
    }
}

second sync response :

{
    "success": true,
    "requestId": 16814855080732,
    "tasks": {
        "rows": [
            {
                "$PhantomId": "_generatedt_e21f9c6f-7f19-4a63-aab6-0b91b17f7399",
                "id": "10283"
            }
        ]
    },
    "revision": 1329
}

third sync payload :

{
    "type": "sync",
    "requestId": 16814855102933,
    "revision": 1329,
    "tasks": {
        "added": [
            {
                "parentIndex": 3,
                "startDate": "2023-04-14T00:00:00-03:00",
                "endDate": "2023-04-15T00:00:00-03:00",
                "duration": 1,
                "durationUnit": "day",
                "cls": "",
                "name": "New task",
                "calendar": null,
                "direction": "Forward",
                "manuallyScheduled": false,
                "unscheduled": false,
                "ignoreResourceCalendar": null,
                "constraintType": null,
                "constraintDate": null,
                "inactive": null,
                "percentDone": 0,
                "segments": null,
                "effort": 24,
                "effortUnit": "hour",
                "effortDriven": false,
                "schedulingMode": "Normal",
                "baselines": [],
                "parentId": null,
                "$PhantomId": "_generatedt_f8225db7-1dc3-46b0-929b-8f88bded7637"
            }
        ]
    }
}

third sync response :

{
    "success": true,
    "requestId": 16814855102933,
    "tasks": {
        "rows": [
            {
                "$PhantomId": "_generatedt_f8225db7-1dc3-46b0-929b-8f88bded7637",
                "id": "10283"
            }
        ]
    },
    "revision": 1330
}

Post by cds_cds_eb »

video :

Attachments
sync.gif
sync.gif (471.29 KiB) Viewed 7953 times

Post by alex.l »

Hi, all your payloads look correct to me. I am out of ideas what's wrong here. Any chance to get runnable application to reproduce that and debug? Or maybe you'll be able to reproduce it with our PHP example which has simple backend. Please try to apply minimal changes to reproduce that and attach the code here. This helps us a lot to go forward.

Thanks!

All the best,
Alex


Post by cds_cds_eb »

Could'nt i just send you the project? is there a way to send it outside the forum?


Post Reply