[CLOSED] Refreshing the Calendar with Remote Events

  1. #1

    [CLOSED] Refreshing the Calendar with Remote Events

    Hi,

    I'm using the Calendar example provided by Ext.NET (http://mvc.ext.net/#/Calendar_Overview/Remote_Data/).
    But when the user changes the date with the mini calendar on the left side, the events calendar does change and show the correct date but the events are not being loaded.

    How do you force a refresh on the Calendar on you call 'setStartDate'?

    Thanks,
    Leo
    Last edited by Daniil; Apr 09, 2014 at 1:41 AM. Reason: [CLOSED]
  2. #2
    Hi @leonardm,

    It seems I cannot reproduce the issue with the online example.

    Quote Originally Posted by leonardm View Post
    How do you force a refresh on the Calendar on you call 'setStartDate'?
    The setStartDate function is:
    setStartDate : function (picker, date) {
        this.getCalendar().setStartDate(date);
    }
    It is defined in common.js:

    common.js
    var CompanyX = {
       getCalendar : function () {
           return CompanyX.CalendarPanel1;
       },
       
       getStore : function () {
           return CompanyX.EventStore1;
       },
       
       getWindow : function () {
           return CompanyX.EventWindow1;
       },
       
       viewChange : function (p, vw, dateInfo) {
            var win = this.getWindow();
            
            if (win) {
                win.hide();
            }
            
            if (dateInfo) {
                // will be null when switching to the event edit form, so ignore
                this.DatePicker1.setValue(dateInfo.activeDate);
                this.updateTitle(dateInfo.viewStart, dateInfo.viewEnd);
            }
        },
        
        updateTitle : function (startDt, endDt) {
            var msg = '',
                fmt = Ext.Date.format;
            
            if (Ext.Date.clearTime(startDt).getTime() == Ext.Date.clearTime(endDt).getTime()) {
                msg = fmt(startDt, 'F j, Y');
            } else if (startDt.getFullYear() == endDt.getFullYear()) {
                if (startDt.getMonth() == endDt.getMonth()) {
                    msg = fmt(startDt,'F j') + ' - ' + fmt(endDt, 'j, Y');
                } else {
                    msg = fmt(startDt, 'F j') + ' - ' + fmt(endDt, 'F j, Y');
                }
            } else {
                msg = fmt(startDt, 'F j, Y') + ' - ' + fmt(endDt, 'F j, Y');
            }
            
            this.Panel1.setTitle(msg);
        },
        
        setStartDate : function (picker, date) {
            this.getCalendar().setStartDate(date);
        },
        
        rangeSelect : function (cal, dates, callback) {
            this.record.show(cal, dates);
            this.getWindow().on('hide', callback, cal, { single : true} );
        },
        
        dayClick : function (cal, dt, allDay, el) {
            this.record.show.call(this, cal, {
                StartDate : dt, 
                IsAllDay  : allDay
            }, el);
        },
        
        record : {    
            addFromEventDetailsForm : function (win, rec) {
                CompanyX.ShowMsg('Event ' + rec.data.Title + ' was added');
            },
    
            add : function (win, rec) {
                win.hide();
                CompanyX.getStore().add(rec);
                CompanyX.getStore().sync();
                CompanyX.ShowMsg('Event ' + rec.data.Title + ' was added');
            },
    
            updateFromEventDetailsForm : function (win, rec) {
                CompanyX.ShowMsg('Event ' + rec.data.Title + ' was updated');
            },
            
            update : function (win, rec) {
                win.hide();
                rec.commit();
                CompanyX.getStore().sync();
                CompanyX.ShowMsg('Event ' + rec.data.Title + ' was updated');
            },
    
            removeFromEventDetailsForm : function (win, rec) {
                CompanyX.ShowMsg('Event ' + rec.data.Title + ' was deleted');
            },
            
            remove : function (win, rec) {
                CompanyX.getStore().remove(rec);
                CompanyX.getStore().sync();
                win.hide();
                CompanyX.ShowMsg('Event ' + rec.data.Title + ' was deleted');
            },
            
            edit : function (win, rec) {
                win.hide();
                rec.commit();
                CompanyX.getCalendar().showEditForm(rec);
            },
            
            resize : function (cal, rec) {
                rec.commit(); 
                CompanyX.ShowMsg('Event '+ rec.data.Title + ' was updated');
            },
            
            move : function (cal, rec) {
                rec.commit(); 
                CompanyX.ShowMsg('Event '+ rec.data.Title + ' was moved to ' + Ext.Date.format(rec.data.StartDate, 'F jS' + (rec.data.IsAllDay ? '' : ' \\a\\t g:i a')));
            },
    
            show : function (cal, rec, el) {
                CompanyX.getWindow().show(rec, el);
            },
            
            saveAll : function () {
                CompanyX.getStore().submitData({
                    mappings : false
                });
            }
        }
    };

Similar Threads

  1. How to update Calendar Events
    By Oliver in forum 2.x Help
    Replies: 1
    Last Post: Feb 14, 2014, 4:47 PM
  2. [CLOSED] Loading Events in Calendar
    By profitsistemas in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 19, 2013, 10:25 AM
  3. [CLOSED] ExtraParams to remote events in treepanel
    By jesperhp in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 16, 2011, 11:36 AM
  4. Calendar - Add Events from code-behind
    By kbugala in forum 1.x Help
    Replies: 0
    Last Post: Oct 20, 2011, 3:29 PM
  5. Replies: 15
    Last Post: Feb 03, 2011, 1:27 PM

Tags for this Thread

Posting Permissions