igorsoaresassis / jmonthcalendar

Automatically exported from code.google.com/p/jmonthcalendar
Other
0 stars 0 forks source link

Events duplicated when page reloaded via Ajax #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
First of all, great plug-in -- it's very clean and nicely done!

What steps will reproduce the problem?
1. Load calendar page via Ajax
2. Re-load same page via Ajax
3. See duplicate entries on calendar

What is the expected output? What do you see instead?
It seems that somehow the events get duplicated (using the demo events) if
the page is re-loaded via ajax. This problem doesn't occur if the page is
completely refreshed via the browser.

What version of the product are you using? On what operating system?
1.2.2

Please provide any additional information below.
One of my page has the div CalendarView, and I have a link on there that
populates this content via:

$.post("calendar_view.php", { emptid: ""+user+"" }, function(data){
    $('#loading').hide();
    $('#calendarView').html(data);
});

calendar_view.php is basically the demo right now, nothing has been changed
as I was testing functionality before implementation.

this page ideally would show events only related to the user selected on
another form. the problem is clicking this link multiple times brings the
same event twice. If it's clicked a 3rd time, they still only show twice
though, so I have a hard time making any logic in this.

Original issue reported on code.google.com by srabo...@gmail.com on 28 Apr 2009 at 8:20

GoogleCodeExporter commented 8 years ago
Not sure if this is the proper way to fix it, but this resolved the issue:

changed jQuery.J.Initialize function
added :
jQuery(".Event", jQuery(ids.container)).remove();
before 
calendarEvents = events;

And everything seems to be working normally. It's now clearing the events before
re-adding them... I suppose this should be fine under the initialize function? 
If
not, hopefully this is a step in the right direction..

Original comment by srabo...@gmail.com on 28 Apr 2009 at 9:02

GoogleCodeExporter commented 8 years ago
Hmm, that is a good safety check. I added jQuery.J.ClearEventsOnCalendar(); 
before
the array is set on initialize to remove any rouge events.  Same this as 
removing all
Event blocks.

Original comment by k.leneau@gmail.com on 15 Jun 2009 at 4:05