[CLOSED] CalendarPanel: How I insert a icon in Event slot?

  1. #1

    [CLOSED] CalendarPanel: How I insert a icon in Event slot?

    Hi!

    I wish insert a icon to indicate that the event is a task in event slot.

    I insert a property in getTemplateEventData function to indicate that the event is a task and change then getEventBodyMarkup function to add the template to icon of Task... and create a Css of task icon... but the icon don´t appears in event slot. What I do wrong?

    Ext.calendar.view.DayBody.override({
            getTemplateEventData: function (evt) {
                var selector = this.getEventSelectorCls(evt[Ext.calendar.data.EventMappings.EventId.name]),
                data = {},
                M = Ext.calendar.data.EventMappings;
    
                this.getTemplateEventBox(evt);
    
                data._selectorCls = selector;
                data._colorCls = 'ext-color-' + (evt[M.CalendarId.name] || '0') + (evt._renderAsAllDay ? '-ad' : '');
                data._elId = selector + (evt._weekIndex ? '-' + evt._weekIndex : '');
                data._isRecurring = evt.Recurrence && evt.Recurrence != '';
                data._isReminder = evt[M.Reminder.name] && evt[M.Reminder.name] != '';
                var title = evt[M.Title.name];
                //data.Title = (evt[M.IsAllDay.name] ? '': Ext.Date.format(evt[M.StartDate.name], 'g:ia ')) + (!title || title.length == 0 ? '(No title)': title);
                data.Title = (evt[M.IsAllDay.name] ? '' : Ext.Date.format(evt[M.StartDate.name], 'H:i ')) + (!title || title.length == 0 ? '(No title)' : title);
                data.Location = evt[M.Location.name]; // added                    
                data.Notes = evt[M.Notes.name]; 
                if ((evt[M.CalendarId.name] || '0') == 11) {      // added
                    data.isTask = true;
                } else {
                    data.isTask = false;
                }
                return Ext.applyIf(data, evt);
            },
    
            getEventBodyMarkup: function () {
                if (!this.eventBodyMarkup) {
                    this.eventBodyMarkup = [
                        '<tpl if="isTask">',
                            '<i class="ext-cal-ic-task">&nbsp;</i>',
                        '</tpl>',
                        '{Title}',
                        '<tpl if="_isReminder">',
                            '<i class="ext-cal-ic ext-cal-ic-rem">&nbsp;</i>',
                        '</tpl>',
                        '<br/>{Notes}',   // added 
                        '<br/>{Location}',   // added                     
                        '<tpl if="_isRecurring">',
                            '<i class="ext-cal-ic ext-cal-ic-rcr">&nbsp;</i>',
                        '</tpl>',
                        '<tpl if="spanLeft">',
                            '<i class="ext-cal-spl">&nbsp;</i>',
                        '</tpl>',
                        '<tpl if="spanRight">',
                            '<i class="ext-cal-spr">&nbsp;</i>',
                        '</tpl>'
                    ].join('');
                }
                return this.eventBodyMarkup;
            }
    
        });
    Style CSS
    .ext-cal-ic-task {
                background-image:url(/resources/image/toolbar/16x16/agendas.png);
                background-repeat:no-repeat;
                display:inline-block;
                height:11px;
                line-height:11px;
                margin-left:4px;
                width:14px;
            }
    Last edited by Daniil; Apr 18, 2012 at 10:02 AM. Reason: [CLOSED]
  2. #2
    Oops... I'm sorry... the only problem was a path to icon...

    Please, desconsidere this thread.

Similar Threads

  1. [CLOSED] CalendarPanel: customizing the event slot.
    By supera in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 04, 2013, 4:40 AM
  2. [CLOSED] CalendarPanel - Add a new slot bellow each regular slot
    By supera in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Jul 11, 2012, 1:02 PM
  3. [CLOSED] CalendarPanel: How I lock moving and resize of Event slot?
    By supera in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Apr 24, 2012, 11:20 AM
  4. Replies: 9
    Last Post: Apr 18, 2012, 2:09 PM
  5. Replies: 5
    Last Post: Mar 28, 2012, 7:38 PM

Posting Permissions