Skip to content

More control over segments / getWeekView #1711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
angelaki opened this issue Apr 15, 2024 · 3 comments
Open

More control over segments / getWeekView #1711

angelaki opened this issue Apr 15, 2024 · 3 comments

Comments

@angelaki
Copy link
Contributor

Is your feature request related to a problem? Please describe

Right now I'm using this (wonderful!) calendar control (among others) to display (off-) peak times. Luckily this can be easily done with the templating system, but: right now I need to call a function the hourSegmentTemplate that gets called pretty often ([class.cal-side-time]="!isWorkingHour(segment.date,group)") causing performance issues on old devices (especially on D'n'D).

Describe the solution you'd like

How about more control or maybe a meta object (like the events have) for the segment object (

)?
Right now I "mock" this a bit by just setting properties in the function, if the value is not present. That's ok, but a bit ... you know ... ugly.

Plus the method gets called pretty, pretty often on D'n'D (what makes it quite slow). Maybe rework it, so the segments won't get recreated but just the events?

Describe your use case for implementing this feature

Off times or other segment specific display options.

Additional context

If you're interessted, I could provide a PR.

@matts-bot
Copy link

matts-bot bot commented Apr 15, 2024

Thanks so much for opening an issue! If you'd like to support this project, then please consider sponsoring me

@mattlewis92
Copy link
Owner

You could try memoizing the isWorkingHour function, so that when it's called with the same arguments it will return a cached version?

@mattlewis92
Copy link
Owner

mattlewis92 commented Apr 19, 2024

You could also try using the beforeViewRender hook to add a property to each segment and avoid the function call in the template, so then you can do something like [class.cal-side-time]="!segment.isWorkingHour"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants