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

Issues with event rendering (they disappear if we switch with previous/next) #163

Closed
billyshena opened this issue Oct 7, 2014 · 8 comments

Comments

@billyshena
Copy link

Hello everyone ! I'm encountering issues about event rendering on the calendar.

  1. I'm basically just fetching some events object on a select box action => $http.get('/myEvents') => $scope.events.push(eachEventHere)
  2. My events are loaded on the calendar (everything works fine at the moment)
  3. If I switch week to week using prev/next and I come back to the original week on the calendar, my events are not displayed anymore.

Does anyone has a real fix for this issue?

Best regards

@softmonkeyjapan
Copy link

I also have the same issue here. The first display works fine but as soon as I change view or navigate using prev/next controls, events disappear from the calendar. However, there are still presents in my event source $scope.events.

Also, when using month as default view and switching back to agendaWeek, it seems to works on the dates ranges of those events. If we navigate further, the same problem appear again.

Here is some informative code about my context :

%div{ "ui-calendar" => "config.calendar", "ng-model" => "eventSources", "calendar" => "calendar" }
# Initialize
$scope.events = []

# Get events from api end point
$scope.getEvents = ->
  Event.all.query {}, (eventsSources) ->
    angular.forEach eventsSources, (sources, index) ->
      angular.forEach sources, (event, index) ->
        $scope.events.push event

# Add it to sources
$scope.eventSources = [$scope.events]

@softmonkeyjapan
Copy link

Ok I did a small hack (ugly) in order to make this work. I'm using the fullCalendar events methods to load my events and apply a condition in it in order to only load all events the first time.

$scope.config =
  calendar:
    events: $scope.getEvents
$scope.events = []
$scope.getEvents = (start, end, timezone, callback) ->
  if $scope.events.length > 0
    callback $scope.events
  else
    events = []
    Event.all.query {}, (eventsSources) ->
      angular.forEach eventsSources, (sources, index) ->
        angular.forEach sources, (event, index) ->
          events.push event
      callback events
      $scope.events = events

$scope.eventSources = [$scope.events]

That works in my case for now. If anyone have a better approach, that would be great.

@M0nter0
Copy link

M0nter0 commented Nov 7, 2014

You can fix that changing calendar.js line 252.
https://github.com/angular-ui/ui-calendar/blob/master/src/calendar.js#L252

eventsWatcher.onAdded = function (event) {
       scope.calendar.fullCalendar('renderEvent', event, true);
};

But there's already an open issue, check #99

@joshkurz
Copy link
Contributor

Sweet find. Could you please open a ticket on the fullcalendar repo and
link back here?
On Nov 28, 2014 1:24 AM, "sMettler" [email protected] wrote:

BUG: missing events after 'changeView'

FIX for me: I removed "defaultView" from my config options!!

whatever value I used (agendaDay, month, agendaWeek....) it made the BUG
show up.

now its defaulting to 'month' but my events are in place!
fullcalendar v2.2.3
angular 1.3.4


Reply to this email directly or view it on GitHub
#163 (comment)
.

@TomasNiDo
Copy link

Adding 'true' fixed the problem, but another issue arise. It's showing duplicate events in my calendar.

@joshkurz
Copy link
Contributor

joshkurz commented May 6, 2015

@VerzatileTom can you open a new issue and send a plunker along with that please? I have not seen that bug yet. Thanks. I am going to close this issue.

@joshkurz joshkurz closed this as completed May 6, 2015
@rysiekblah
Copy link

it works good now but you have to use stick property for event:
stick: true

@TomasNiDo
Copy link

@joshkurz It's my silly mistake, i added the events the wrong way. I'm good now.

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

No branches or pull requests

6 participants