Our powerful JS Calendar component


Post by yannis »

Hi !
With my team we would like to edit the event duration based on certain user choices.
To make it simple, the user selects a type of appointment which automatically fills in the startTime and endTime fields of the eventEditor (So we want to update the duration of the event when selecting the "type" field).

We tried with the setDuration but it causes the event to be recorded (which does not succeed)

Here is our code for the comboField which should update the duration of the event

Thanks for help,

	typeField: {
				required: true,
				editable: true,
				weight: 2,
				type: "combo",
				store: typesStore,
				label: "type",
				valueField: "scheduleStatus",
				displayField: "label",
				name: "status",
				value: 1,
				clearable: true,
				onSelect(event: any) {
					if (event.record && event.userAction) {
						const eventEditor = this.up()
						eventEditor.eventEditFeature.eventRecord.setDuration(0.5, "h")
					}
				},
	}
Attachments
Capture d’écran de 2022-05-09 15-04-55.png
Capture d’écran de 2022-05-09 15-04-55.png (39.99 KiB) Viewed 274 times

Post by saki »

It is not fully clear to me what

it causes the event to be recorded (which does not succeed)

actually fails here. I was trying to update the underlying record of the editor by calling setDuration and the only problem I run into was that editor fields were not updated. This is easily remedied by setting autoUpdateFields:true on the eventEdit feature.

If there is another issue you are facing, post please a runnable showcase so that we can sort it out.

Note: There is a ticket to make the property public https://github.com/bryntum/support/issues/4588


Post Reply