Issue 1881: Unable to load mothly event list
Status:  Invalid
Owner: ----
Closed:  Aug 2013
Reported by sandhya....@indianic.com, Jun 19, 2013
I want a functionality where in on changing the months the event list of the related month must be listed. But i am not able to achieve this.My code is as below. Amy help will be highly appreciated.
$('#calendar').fullCalendar({
			header: {
				left: 'prev,next today',
				center: 'title',
				right: 'month,agendaWeek,agendaDay'
			},
			viewDisplay:function(view){
				//alert(view.name);
				//alert(view.title);
				if(view.name=='month'){
					/*var source = [];
					$.ajax({
			url: "ajax.php?index=getCallCycles&format=data",
            type: 'Post',
            data: { 'month':view.title,
			'employee_id':<?php echo $_REQUEST['employee']?>,
			'order_by':'cc.`frequency` ASC, cc.`date` DESC'},
			success: function (response){
				var obj = $.parseJSON(response);
				 $.each(obj, function(index, element) {
				 	source.push({
								id: element.ccid+"_"+element.frequency,
								title: element.store_name,
							});
				 });
				// console.log(source);
				  $('#calendar').fullCalendar('removeEventSource');	
			 $('#calendar').fullCalendar( 'addEventSource', source );	 
			}
			
		});*/
			
		 var events = {
                  url: "ajax.php?index=getCallCycles&format=data",
            type: 'Post',
            data: { 'month':view.title,
			'employee_id':<?php echo $_REQUEST['employee']?>,
			'order_by':'cc.`frequency` ASC, cc.`date` DESC'}
            }
				$('#calendar').fullCalendar('removeEventSource');	
			 $('#calendar').fullCalendar( 'addEventSource', events );	
			 $('#calendar').fullCalendar('rerenderEvents');
				 //$('#calendar').fullCalendar('addEventSource', response); 
				     
			   	  //$('#calendar').fullCalendar('addEventSource', source);
				//$('#calendar').fullCalendar( 'refresh' );
				//$('#calendar').fullCalendar('refetchEvents')
				}
			},	
			selectable: true,
			selectHelper: true,			
			allDaySlot: false,
			slotMinutes: 15,	
			firstHour: 9,	
			minTime: 9,
			maxTime: 18,
			prefetchEvents:false,
			events: function(start, end, callback) {
			/*$.ajax({
				url: "ajax.php?index=getCallCycles&format=data",
				type: 'Post',
				data: {
					'month':month_title,
					'employee_id':<?php echo $_REQUEST['employee']?>,
					'eDates':'NOT NULL',
					'order_by':'cc.`frequency` ASC, cc.`date` DESC'
				},
				success: function(response) {
					var events = [];
					if($.trim(response)!=''){
						var obj = $.parseJSON(response);
					 $.each(obj, function(index, element) {
						var allDates = element.eDates.split(",");
						 $.each(allDates, function(i,date) {
						 	// convert string to date.

// Or pick data from textbox


//var endDate =Date.parse($.trim(date.toString()));
//var myDate = new Date('January 16, 1988 2:54:16 pm');
//alert(myDate);
						 	//alert(date.toString());
							//alert(element.duration);
							//alert(newdate);
							var address = "<p><span class='contnet-title'>Address:</span> "+element.store_address+', '+element.store_suburb+', '+element.store_state+'-'+element.store_postcode+"</p>";
				var phone = "<p><span class='contnet-title'>Contact No:</span> "+element.store_phone+"</p>";
				var status = "<p><span class='contnet-title'>Visit:</span> "+element.frequency+" / "+element.duration+" Mins</p>";
				var start = "<p><span class='contnet-title'>Start:</span> "+date+"</p>";
				var button = "<p><input type='button' id='delete'  value='delete' onClick='return removecycle("+element.ccid+");'/>";
				var closebutton = "<input type='button' id='closecycle'  value='close' onClick='return closecycle();' /></p>";
				var color='';
				if(element.frequency == "Monthly"){
					color = "#5485C7";
				}else if(element.frequency == "Weekly"){
					color = "#002D4C";
				}else if(element.frequency == "Fortnight"){
					color = "#419094";
				}
				

						 	events.push({
								id: element.ccid+"_"+element.frequency,
								title: element.store_name,
								start:date,
								description:address+" "+phone+" "+status+" "+start+" "+button+" "+closebutton,
								color:color
								
							});
						});		 		
					 });

					}
					//console.log(events);
					 callback(events);
				}
			});*/
    	},
			editable: true,			
			disableResizing: true,		
			timeFormat:{				
    			'': ''
			},
			eventDrop: function(event,dayDelta,revertFunc) {
		        edate = $.fullCalendar.formatDate( event.start, "dd" );             
				eday = $.fullCalendar.formatDate( event.start, "ddd" );
				//fdate = $.fullCalendar.formatDate( event.start, "yyyy-MM-dd" );
				fdate = $.fullCalendar.formatDate( event.start, "yyyy-MM-dd HH:mm:ss" );				
				//alert(event.start); return false;				
                $.ajax
                ({
                    url: "insert_event.php",
                    type: 'Post',
                    data: { 'ID': event.id, 'title': event.title, 'I_Date': edate, 'I_Day':eday,"F_Date":fdate,"dayDelta":dayDelta},
                    success: function (response)
                    {
                    	//alert(response); return false;
						//window.location.reload();
						if(response != "success"){
							alert(response);
						}
						$('#calendar').fullCalendar('removeEvents');
						$('#calendar').fullCalendar( 'refresh' );
						$('#calendar').fullCalendar('refetchEvents');
                    }
                });
				
		
		    },
		    select: function(date){		
		    	var d = new Date();
				var n = d.getMonth() + 1; 
		    	month = $.fullCalendar.formatDate( date, "MM" );
		    	if(month == n){
			    	fdate = $.fullCalendar.formatDate( date, "yyyy-MM-dd HH:mm:ss" );	
			    	$( "#dialog" ).dialog( "open" );
			    	$("#title" ).val("");
			    	$("#duration" ).val("15");
			    	$("#dat").val(fdate);
		    	}else{
		    		//alert("Please select current month date only");
		    		return false;
		    	}
		    },
			droppable: true, // this allows things to be dropped onto the calendar !!!
			drop: function(date, allDay) { // this function is called when something is dropped				
				// retrieve the dropped element's stored Event Object
				//alert($(this).data('eventObject'));
				var originalEventObject = $(this).data('eventObject');
				//alert(originalEventObject);
				// we need to copy it, so that multiple events don't have a reference to the same object
				var copiedEventObject = $.extend({}, originalEventObject);
				
				
								
				// assign it the date that was reported
				copiedEventObject.start = date;
				copiedEventObject.allDay = allDay;
				console.log(copiedEventObject);
				// render the event on the calendar
				// the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
				$('#calendar').fullCalendar('renderEvent', copiedEventObject, true);
				
				// is the "remove after drop" checkbox checked?
				//if ($('#drop-remove').is(':checked')) {
					// if so, remove the element from the "Draggable Events" list
					
				//}
				
				edate = $.fullCalendar.formatDate( date, "dd" );             
				eday = $.fullCalendar.formatDate( date, "ddd" );
				fdate = $.fullCalendar.formatDate( date, "yyyy-MM-dd HH:mm:ss" );				
								
                $.ajax
                ({
                    url: "insert_event.php",
                    type: 'Post',
                    data: { 'ID': copiedEventObject.id, 'title': copiedEventObject.title, 'I_Date': edate, 'I_Day':eday,"F_Date":fdate},
                    success: function (response)
                    {
                    	//alert(response);return false;
						//window.location.reload();
						if(response != "success"){
							alert(response);
							
						}else{
							$("#"+copiedEventObject.id).remove();	
						}
					
						$('#calendar').fullCalendar('removeEvents');
						$('#calendar').fullCalendar( 'refresh' );
						$('#calendar').fullCalendar('refetchEvents');
					
                    }
                });
				
			},			
            eventRender: function(event, element) {
	            element.qtip({    
	            content: {    	          
	            	title: event.title,      
	                text: event.description       
	            },

	          
	            show: { when: 'click', solo: true },
				hide: { when: 'click', solo: true },
	            //hide: { when: 'inactive', delay: 3000 },
	            
	            position: {
					      adjust: {
						 	screen: true // Keep the tooltip within the viewport at all times
					      }
					   }, 
	            style: { 
	                width: 300,
	                padding: 5,
	                color: 'black',
	                textAlign: 'left',
	                border: {
	                width: 1,
	                radius: 3
	             },
	                tip: 'topLeft',
	
	                classes: { 
	                    tooltip: 'ui-widget', 
	                    tip: 'ui-widget', 
	                    title: 'ui-widget-header', 
	                    content: 'ui-widget-content' 
	                } 
	            } 
	        });
            }
		});


Aug 24, 2013
Project Member #1 adamrs...@gmail.com
(No comment was entered for this change.)
Status: ReproTemp
Aug 25, 2013
Project Member #2 adamrs...@gmail.com
This message is being bulk-sent to a number of issues, both [very] old and new.

I have been working on taming this issue tracker, which has gotten out of control after months of neglect. You are receiving this message because I could not successfully reproduce the bug you were reporting with a reasonable amount of effort. I have written some new bug-report guidelines to be used by all bug reports going forward:

    http://arshaw.com/fullcalendar/wiki/Report-a-Bug/

Its salient point is that all bug reports should have an isolated demonstration, viewable online with a tool like JSFiddle.

If the bug you originally reported is still important to you, could you please first try the latest version of FullCalendar and see if it is fixed? If not, could you please file a NEW bug report that follows the new guidelines? This issue will not be monitored for further comments.

I'm sorry I have taken so long to respond to many of your request, and I'm sorry if this new procedure causes extra work for you. Going forward, the issue tracker will be much more of a well-oiled machine.

Again, if you must, PLEASE SUBMIT A *NEW* BUG REPORT (following the new guidelines) INSTEAD OF COMMENTING ON THIS ONE. Further comments on this report will be ignored. Thanks.
Status: Invalid
Labels: Type-Bug