php - Popup dialog with event details keeps the same even if another id is used -
i have integrated fullcalendar json , php events small calendar widget works well.
i have coded css/div popbox passed event id via eventclick function when event clicked opens , uses ajax request passed id full event details focussed popbox.
i can close popbox without issue when click next/previous/today tabs calendar refreshes , fires off last viewed popbox.
i assume because calendar , ajax popbox using javascript event , being tied together.
can few lines stop this?
my code:
$('#calendar').fullcalendar({ editable: false, cache: false, header: {left: 'title',center: '',right: 'today,prev,next'}, events: function(start, end, callback) { $.getjson("/mod/calendar/events.php?ts=1302604339", { action: "get_events", start: start.gettime(), end: end.gettime(), id: 'a', etype: "club" }, function(result){ callback(result); } ); }, eventclick: function(calevent){ if (calevent.txt) { open_popbox(calevent.txt,''); return true; } else{ return true; } } }); the popbox code:
function open_popbox(id,r) { $("#popbox").css("height", $(document).height()); //$("#cmt_u_pload").show(); var str = "id="+id+"&r="+r; $.ajax({ type: "post", url: "/ajax/popbox.php", data: str, success: function(result){ $("#aj_popbox").ajaxcomplete(function(event, request, settings) { //$("#cmt_u_pload").hide(); response = result.substring(0,3); if(result.substring(0,3)=="ok-"){ len = result.length; result = result.substring(3,len); } $(this).html(result); $("#popbox").fadein(); }); } }); return false; } and popbox closed this:
function close_popbox(){ $("#popbox").fadeout(); }
i have been working fullcalendar daily 2 weeks , found few side effects.
you need carefull calling event from. every time click next/prev day, change views events fired over.. , not split.
what mean changes on current view can trigger event. had quick @ code , pop box works ok. when click button automatically fire events. got bit lost @ point
function(result){callback(result);});}, begins ?.. because not use that. cause why firing last event.
maybe try this
$('#calendar').fullcalendar({ header: { left: 'today', center: 'prev,title,next', right: 'month,basicday' }, eventclick: function( event, jsevent, view ) { open_popbox(event.txt,'') }, events: '/mod/calendar/events.php?ts=1302604339' }); inside eventclick can check event or view calling function. jsevent can show source click info.
breaking down easier debug.
hope helps.
Comments
Post a Comment