Our pure JavaScript Scheduler component


Post by dmiedzinski »

Hi

Our usecase is to set visible view range starting from same date only, ignores zoomDate.

User has 5 custom view presets. Timeline is infinite scroll but we need to move timeline start after every zoomin/zoomout operation to the same startDate

How to done this?

this.scheduler.onBeforePresetChange = (event: {
			source: Scheduler;
			startDate: Date;
			endDate: Date;
			from: ViewPreset;
			to: ViewPreset;
		}) => {
			event.startDate = this.viewStartDate;
			event.source.visibleDate = this.viewStartDate;			
		};
		this.scheduler.onPresetChange = (event: {
			source: Scheduler;
			startDate: Date;
			centerDate: Date;
			endDate: Date;
			from: ViewPreset;
			to: ViewPreset;
		}) => {
			
		event.startDate = this.viewStartDate;
		event.source.visibleDate = this.viewStartDate;		
	};

this mutations on events looks like not working.


Post by alex.l »

All the best,
Alex


Post by dmiedzinski »

I have seen this, it was ignored for me :|
Not working as expected or not working completely im not sure.
I will try to fix it, if not i will prepare some reproduction example. Do you have some basic stackblitz project or something?

Is there any other way to force scroll to startDate if infinite scroll is enabled?


Post by alex.l »

I missed that you enabled that option. if infiniteScroll is enabled, you can't use zoomKeepsOriginalTimespan since start/end dates are not fixed. Sorry for confusing. I guess I got your need now and using https://bryntum.com/products/schedulerpro/docs/api/SchedulerPro/view/SchedulerPro#property-visibleDate looks correct.
You'll need to set visibleDate with zoom options start (see docs) so you will be able to get what you want.

In your code I see event.startDate = this.viewStartDate, not sure what it means, you do not need that, just configure visibleDate with block: start

All the best,
Alex


Post by dmiedzinski »

i used event.startDate = this.viewStartDate just trying to fix it :).
but even with your solution (i tested before) i have strange feeling that this readonly zoomDate in that event is broke everything :)

Nevermind, i have some misconfiguration. Works for now. Thanks :)


Post by alex.l »

Glad to hear. Please let us know if further assistance required.

All the best,
Alex


Post Reply