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

afterRenderEvent not fired when in readonly mode #1327

Closed
stan5521 opened this issue Dec 10, 2022 · 2 comments · Fixed by #1352
Closed

afterRenderEvent not fired when in readonly mode #1327

stan5521 opened this issue Dec 10, 2022 · 2 comments · Fixed by #1352

Comments

@stan5521
Copy link

stan5521 commented Dec 10, 2022

Version

TOAST UI Calendar 2nd Edition @Version 2.1.3

Test Environment

Browser: Chrome Version 108.0.5359.99 (Official Build) (64-bit)

Current Behavior

When using the calendar in readonly mode the afterRenderEvent is not fired when redering events, this is the code i use:

const app = calendar.querySelector(".tui-main-calendar");

calendar.tuiCalendar = new tui.Calendar(app, {
    defaultView: 'month',
    disableDblClick: true,
    usageStatistics: false,
    useDetailPopup: false,
    useFormPopup: false,
    isReadOnly: true,
    month: {
        startDayOfWeek: 1,
        dayNames: ['Zondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag'],
    },
    theme: {
        common: {
            holiday: {
                color: 'black',
            },
        },
        month: {
            holidayExceptThisMonth: {
                color: 'rgba(51, 51, 51, 0.4)',
            },
        },
    }
});

calendar.tuiCalendar.on('afterRenderEvent', (eventObj) => {
    console.log(eventObj);
});

calendar.tuiCalendar.createEvents([
    {
        id: 'event3',
        calendarId: 'cal2',
        title: 'Vacation',
        start: '2022-12-27',
        end: '2022-12-27',
        description: "Deze periode hebben we vacantie",
        isAllday: true,
        category: 'allday',
    },
    {
        id: 'event3',
        calendarId: 'cal2',
        title: 'Vacation',
        start: '2022-12-29',
        end: '2022-12-29',
        description: "Deze periode hebben we vacantie",
        isAllday: true,
        category: 'allday',
    },
]);

When i switch isReadOnly to false it will output 2 events in the console. When isReadOnly is true it will not log anything.

Expected Behavior

I couldn't find anything in the docs about this event not working in read only mode (some other events in the docs do state isReadOnly: false is needed). But the events that need isReadOnly: false are mostly events that only happen when editing/changing/removing things which isn't posible in read only mode so it makes sense. I think there are many use cases where you want the read only mode in combination with this event.

@stan5521 stan5521 changed the title afterRenderEvent not triggered when in readonly mode afterRenderEvent not fired when in readonly mode Dec 10, 2022
@adhrinae
Copy link
Contributor

adhrinae commented Dec 12, 2022

@stanverbakel

Thanks for the report. Apparently, this condition should be changed to isNil(resizingWidth) && isNil(movingLeft). Note that this bug appears only for events in the monthly view and all-day events in the weekly view.

Please understand I can guarantee the release date of the patch.

@stan5521
Copy link
Author

stan5521 commented Dec 15, 2022

Thanks! I will edit the source files and rebuild so i can use your solution until there is a version released with this fix. Thanks for your fast reply and fix.

blacktoast added a commit to blacktoast/tui.calendar that referenced this issue Jan 17, 2023
blacktoast added a commit to blacktoast/tui.calendar that referenced this issue Jan 17, 2023
adhrinae pushed a commit that referenced this issue Jan 25, 2023
fix: afterRenderEvent doesn't work in readonly mode ( fix #1327 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants