-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Asynchronous event get #150
Comments
👍 |
What about spin.js? ( http://fgnass.github.io/spin.js/) |
Spin looks good. The only problem I would not want to add one more dependency. Although this one looks cool. @mlocati I agree that calendar
No matter if it sync or async it will fail if it is too long. |
I agree. What about standard animated gif image?
Well, I'd made it 100% of the screen, not the context: this way the users can't click other controls.
Yes, but the user experience is really bad on sync calls: the whole page freezes and it seems to the users that nothing is happening, except a browse freeze. |
How about you include options before and after event callbacks for users, so you can implement a loading gif or spin.js yourself? |
That would be nice: this could lead to a better integration with the page in which the calendar is in. |
Yeah, I think that would be the best option. I'm not too fond with AJAX myself, so someone else will have to make it, but it would be really nice. |
Perfect! And by default we will use simple lock with gif. Thene very user will be able to adopt lok to style that is used through all site. @gdscei - genius. |
I think async event loading makes a lot of sense when you query calandar data from the backend and the data is retrieved on the fly. If made synchronous, this causes major UI freezes and significantly deteriorates UX. Any of you guys actually made async AJAX work? Would be nice to see the code. |
We will |
Would love to be able to fetch data without the need of async |
Hi, I needed async event fetching too, so I was going to make a pull request for optionally returning a jquery promise for events_source. When looking into it I found a quick and dirty workaround though. I may still go the promises route, but for anyone else wanting something similar here's a quick stripped down example of loading events asynchronously with the current implementation which works by stalling the call to events_source until your events are (async) loaded:
Note; this uses internals, hence quick-and-dirty. Also it exposes a more serious bug around the internal module logic, which is that there is a secret and seemingly ignored async call between _loadEvents() and _render() where _loadEvents is waiting on a callback to continue. This sets up a race condition, hence the need to explicitly call _render() in the above. |
I had the same issue, but I went for another strategy. I changed the loader() definition so it accepts a callback. This callback is called when the events are retrieved. Of course the calendar doesn't render until the events are fetched, but onBeforeEvents is not blocked. That wa I can use this function to display a loading gif or something on my page. Here is the relevant code I changed, maybe you can tell me if there is something wrong: The view functions takes a callback:
Works but nothing is displayed until the events are loaded. |
Using workaround mentioned here: Serhioromano/bootstrap-calendar#150 (comment)
Instead of making the AJAX request synchronous, which can lock up the browser window if the server takes too long, please make the get event request asynchronous with callbacks instead.
This can prove major trouble in the case of where the server takes too long to respond, and for example, Google Chrome will tell you that the page is stuck.
The text was updated successfully, but these errors were encountered: