Skip to content
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

Missing scheduler reference in vertical mode layoutFn #8879

Closed
einmalick opened this issue Mar 25, 2024 · 4 comments
Closed

Missing scheduler reference in vertical mode layoutFn #8879

einmalick opened this issue Mar 25, 2024 · 4 comments
Assignees
Labels
bug Something isn't working resolved Fixed but not yet released (available in the nightly builds)
Milestone

Comments

@einmalick
Copy link

In vertical mode of SchedulerPro, the layoutFn function within eventLayout lacks the necessary scheduler reference. As discussed in #7659 and #5133, this reference is crucial for certain functionalities. Currently, it leads to undefined behavior, hindering proper customization.

Current Behavior:

In vertical mode:

new SchedulerPro({ 
    mode: 'vertical', 
    eventLayout : { 
        type: 'stack',
        layoutFn(items) { 
            console.log(this.scheduler) // => undefined 
            // this.scheduler is not defined 
            return this.scheduler.rowHeight 
        } 
    } 
})

Expected Behavior:

The layoutFn function within eventLayout should have access to the scheduler reference in both vertical and horizontal modes. For instance:

new SchedulerPro({ 
    mode: 'vertical', 
    eventLayout : { 
        type: 'stack', // default fallback layout type
        layoutFn(items) { 
            console.log(this.scheduler) // should log the scheduler reference
            if(item.someCondition) {
                item.width = this.scheduler.rowWidth // or this.scheduler.rowHeight. Information in the  Bryntum documentation on how to recreate the expected behavior of the layout types "stack, mixed, pack, none" with a custom layoutFn would be very helpful.
            }
            // return this.scheduler.rowHeight
            // When nothing is returned, the default behavior of the currently set eventLayout type should be used.
        } 
    } 
})

Additional Notes:

  • The absence of the scheduler reference in vertical mode impedes proper customization and may lead to unexpected behavior.
  • The suggested modification ensures consistency across different modes and allows for more flexible customization.
  • The layoutFn function in this example should only affect items with matching conditions, while other items should be displayed using the default behavior of the specified eventLayout type.

This issue is crucial for ensuring the robustness and flexibility of SchedulerPro, especially in scenarios where custom layouts are necessary. Any insights or updates on this matter would be greatly appreciated.

@matsbryntse matsbryntse added bug Something isn't working ready for review Issue is fixed, the pull request is being reviewed labels Mar 25, 2024
@matsbryntse matsbryntse self-assigned this Mar 25, 2024
@isglass isglass added resolved Fixed but not yet released (available in the nightly builds) and removed ready for review Issue is fixed, the pull request is being reviewed labels Mar 26, 2024
@isglass isglass added this to the 5.6.9 milestone Mar 26, 2024
@einmalick
Copy link
Author

@isglass and @matsbryntse Is the functionality of the "Expected Behavior" code snipped being added to 5.6.9?

type: 'stack', // default fallback layout type
// When nothing is returned, the default behavior of the currently set eventLayout type should be used.

Information in the Bryntum documentation on how to recreate the expected behavior of the layout types "stack, mixed, pack, none" with a custom layoutFn would be very helpful.

@matsbryntse
Copy link
Member

@einmalick Please post general questions in our support forums. We only use this repo for bug reports. https://forum.bryntum.com/

@einmalick
Copy link
Author

einmalick commented Apr 26, 2024

According to the version history, this bug was supposed to be resolved with the release of v5.6.9: https://bryntum.com/products/schedulerpro/docs/guide/SchedulerPro/changelog

However, even in the latest version, 5.6.10, there is still no scheduler reference for the vertical-mode layoutFn. I conducted tests with the updated version 5.6.10 on a local project and also examined the Scheduler Pro example for custom layouts: https://bryntum.com/products/schedulerpro/examples/custom-layouts/

In HORIZONTAL mode:
Bildschirmfoto 2024-04-26 um 10 56 52

In VERTICAL mode:
Bildschirmfoto 2024-04-26 um 10 57 18

@matsbryntse , @SergeyMaltsev: this this issue should be reopened.

@matsbryntse
Copy link
Member

Slight confusion here, the Scheduler instance is available as the 3rd param of the layoutFn.

layoutFn(events, resourceRecord, scheduler)

Will check to ensure docs describes this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resolved Fixed but not yet released (available in the nightly builds)
Projects
None yet
Development

No branches or pull requests

3 participants