Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Don't wrap callback functions which need to return value to fullcalendar... #123

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adieu
Copy link

@adieu adieu commented Jul 2, 2014

According to http://arshaw.com/fullcalendar/docs1/mouse/eventClick/ and http://arshaw.com/fullcalendar/docs1/event_data/eventDataTransform/ , after fullcalendar calls eventClick and eventDataTransform, it will then consume the return value.

If we wrap those two callbacks with wrapFunctionWithScopeApply, the wrapper function calls the wrapped function with $timeout and never pass the return value back to fullcalendar.

This breaks the design of these callbacks.

To fix this issue, the patch just avoid to wrap eventClick and eventDataTransform. I just did a quick scan of the documents and only find these two. There might be more callbacks to ignore.

This PR fixed #122

jvorcak added a commit to jvorcak/ui-calendar that referenced this pull request Aug 26, 2014
@janjaapdriessen
Copy link

Ran into this exact issue with the eventClick option.

@janjaapdriessen
Copy link

Actually, I wouldn't mind if eventRender would also not be wrapped in the "wrapFunctionWithScopeApply".

@joshkurz
Copy link
Contributor

hey @adieu I see your issue, but the only thing I don't like about this, is we are hardcoding the function values into the calendar. I don't feel like crawling through the entire fullcalendar api either, so I think a solution like the one in this Plunker would work better. http://plnkr.co/edit/gdQtxBLH0LJaHc7Yam9X?p=preview

We are setting the ignore array on the uiCalendarConfig, so the user can specify which functions to not wrap in a safe $timeout.

What do you think about this solution?

Also another solution, is to rip out the wrap all together. I think developers should know to wrap their functions in $apply anyways.

@joshkurz
Copy link
Contributor

I think #213 will fix this.

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

Successfully merging this pull request may close these issues.

wrapFunctionWithScopeApply breaks eventDataTransform
3 participants