angular-ui / ui-calendar

A complete AngularJS directive for the Arshaw FullCalendar.
http://angular-ui.github.io/ui-calendar/
MIT License
1.49k stars 728 forks source link

Newly added Events disappears when changing month #480

Open pnrdk opened 7 years ago

pnrdk commented 7 years ago

When I add new events to the calendar after the calendar already has been loaded, they are being added like they shall. But when I am switching the month forward and afterwards backwards, the event has disappeared. I think the same thing is happening in your demo.

What to do?

Thanks very much in advance.

jhgil commented 7 years ago

I have same problem.....

jhgil commented 7 years ago

Adding new events issue

When adding new events to the calendar they can disappear when switching months. To solve this add

stick: true to the event object being added to the scope.

pnrdk commented 7 years ago

@jhgil Thanks very much for sharing the solution with me! It Works :-)

mahfuz10 commented 6 years ago

https://fullcalendar.io/docs/event_rendering/renderEvent/

I did this in jQuery and it works. May be, this code can help someone.

var event = new Object();
event.id = 123; // unique event id;
event.title = 'some title';
event.start = new Date(2017,11,4, 00, 00);
event.end = new Date(2017,11,6,00,00);
$('#calendar').fullCalendar( 'renderEvent', event, true );
// 3rd parameter is - `stick: true`
eliakaram93 commented 6 years ago

guys, the thing is when my page initially is loaded all my events from the database are shown after I add an event I'm inserting into the DB removing the events then refetching works like a charm to remove duplicate data but when I press the previous and the next button the only thing that will appear is the last event rendered in the calendar all the rest are gone and I'm using stick true

Adam1210 commented 6 years ago

I am adding stick: true to the event object and it all it does is disables the arrow buttons to go to next and previous months. I still want to be able to look at other months but also keep my events rendered.

Mwangangi commented 5 years ago

Adding new events issue

When adding new events to the calendar they can disappear when switching months. To solve this add

stick: true to the event object being added to the scope.

You're the best

juanmarcus93 commented 5 years ago

@jhgil and @mahfuz10 I love you guys!

tayfunerbilen commented 5 years ago

https://fullcalendar.io/docs/event_rendering/renderEvent/

I did this in jQuery and it works. May be, this code can help someone.

var event = new Object();
event.id = 123; // unique event id;
event.title = 'some title';
event.start = new Date(2017,11,4, 00, 00);
event.end = new Date(2017,11,6,00,00);
$('#calendar').fullCalendar( 'renderEvent', event, true );
// 3rd parameter is - `stick: true`

you saved my time, thanks bro.

advancedsoftwarecanada commented 4 years ago

Confirmed that "true" for the sticky flag works. Thanks.