views:

111

answers:

1

I'm using Fullcalendar in my Asp.Net 1.1 application. For taking data from server side, I use Ajaxpro. So codes to gets events to Fullcalendar are written as below:

    $calendar.fullCalendar({        
        editable: true,
        selectable: true,
        theme: true,
        height: 545,                
        defaultView: 'agendaWeek',
        header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },
        events: function(start, end, callback) {
            dss.user_activity.getActivities(function(doc) {
            var events = [];
                        var obj = jQuery.parseJSON(doc.value);
                        $(obj.Head).each(function() {                           
                            events.push({
                id: this.SQ_USER_ACTIVITY_ID,
                            title: this.CH_SUBJECT,
                            start: this.start, 
                end:   this.end,
                allDay: this.BL_ALL_DAY             
                            });
                        }); 
                      callback(events);
            });
            }
});

But I have a problem that, When I drag an events which came from database and switch Calendar's view, all events go back to their default location.

I want changed events to protect their location, when I swtich the Calendar view.

+1  A: 

You need to save events to the database, then. Use a callback on the drop event for your event to save it to the database. When you switch views, it refreshes the events by calling the database.

justkt
Thanks for you reply. Saving events to database for every change event is not a useful way. I lastly click a save button to save them all.
mavera
Then I'd check on a way to keep it from going to the server to fetch events it already has when you change the view. What is happening right now is default behavior.
justkt
What exactly is happening that, events function trigered in every switching and dss.user_activity.getActivities function is running. Normally if I write only server-side code I could get rid of this issue with page.ispostback method. But in client-side I don't know how to do a behaviour like ispostback control.
mavera
You need to look at the Javascript events called in fullcalendar to find the answer to your question.
justkt