fireholster
fireholster

Reputation: 640

Full Calendar Events not getting displayed

I am having some trouble in displaying the events on fullcalendar. Can someone please help? it was working fine till I introduced the end date here in database. I have already tried by removing it from calendar but it still doesn't work.

I am trying to bind json data returned by my mvc controller. The Json looks fine and is coming as:

{ id = 1, title = "XYZ Apple", start = "2013-10-02T00:00:00.0000000", end = "2013-10-06T00:00:00.0000000", allDay = true }  

{ id = 3, title = "XYZ Apple", start = "2013-10-03T00:00:00.0000000", end = "2013-10-10T00:00:00.0000000", allDay = true }
{ id = 4, title = "XYZ Apple", start = "2013-10-04T00:00:00.0000000", end = "2013-10-07T00:00:00.0000000", allDay = true }
{ id = 5, title = "XYZ Apple", start = "2013-10-07T00:00:00.0000000", end = null, allDay = true }
{ id = 6, title = "XYZ Apple", start = "2013-10-08T00:00:00.0000000", end = "2013-10-08T00:00:00.0000000", allDay = true }
{ id = 7, title = "XYZ Apple", start = "2013-10-09T00:00:00.0000000", end = "2013-10-15T00:00:00.0000000", allDay = true }

On load returning the custom error:

"Error while Getting events!"

This is the calendar I have

var calendar = {
    header: {
        left: 'prev,next',
        center: 'title',
        right: 'today, basicDay,basicWeek,month'

    },
    defaultView: 'month',
    buttonText: {
        today: 'Today',
        day: 'Day',
        week: 'Week',
        month: 'Month',
        prev: 'Prev', 
        next: 'Next', 

    },
    weekends: true, 
    editable: true,
    events: {
        url: 'FullCalendar/GetEvents',
        color: 'yellow',
        error: function () {
            alert('Error while Getting events!');
        }
    }
};
myCalendar.fullCalendar(calendar);

Upvotes: 0

Views: 594

Answers (2)

Sharvari
Sharvari

Reputation: 257

In your json data try this "allDay":"false". May be it will help you. If it not works then put your json data statically and try to find out where you are wroung.

events: [
{ id = 1, title = "XYZ Apple", start = "2013-10-02T00:00:00.0000000", end = "2013-10-06T00:00:00.0000000", allDay = true },  

{ id = 3, title = "XYZ Apple", start = "2013-10-03T00:00:00.0000000", end = "2013-10-10T00:00:00.0000000", allDay = true },
{ id = 4, title = "XYZ Apple", start = "2013-10-04T00:00:00.0000000", end = "2013-10-07T00:00:00.0000000", allDay = true },

{ id = 6, title = "XYZ Apple", start = "2013-10-08T00:00:00.0000000", end = "2013-10-08T00:00:00.0000000", allDay = true },
{ id = 7, title = "XYZ Apple", start = "2013-10-09T00:00:00.0000000", end = "2013-10-15T00:00:00.0000000", allDay = true }]

Upvotes: 0

MikeSmithDev
MikeSmithDev

Reputation: 15797

Your JSON is not fine. It should look like this:

[{"id":"1","title":"XYZ Apple","start":"2013-10-02T00:00:00.0000000","end":"2013-10-06T00:00:00.0000000","allDay":"true"},
{"id":"3","title":"XYZ Apple","start":"2013-10-03T00:00:00.0000000","end":"2013-10-10T00:00:00.0000000","allDay":"true"}]

You can validate your JSON at JSONLint.

Upvotes: 1

Related Questions