[CLOSED] Ext.net.EventModel: There are any way to add a property in this class?

  1. #1

    [CLOSED] Ext.net.EventModel: There are any way to add a property in this class?

    Hi!

    I load in CalendarPanel my schedules and my tasks too... The records are storage in diferent tables in my DB.
    In my webservice, I load the schedules and task in a Ext.net.EventModelCollection, with CalendarID differents for each type of record (task or schedule).
    It´s works fine...

    But, the tasks have a property called 'Priority' with values between 'Urgent' and 'low priority'.
    I wish renderer in event slot a icon to this priority... I know when I do this... but I don´t know a way to create a new property in EventModel (without change the source code).

    Thanks for any tip.
    Last edited by Daniil; Apr 19, 2012 at 4:41 PM. Reason: [CLOSED]
  2. #2
    Hi,

    You can extend the EventModel class.
    class MyEventModel : EventModel
    {
    
    }
  3. #3
    Right ... and in javascript? Will be created automatically the property on the record object?


    I'm override the getTemplateData and getEventBodyMarkup of view.DayBody (you pass this script to me)...
    In this point I need get the property value:

    Follow the overrided script:

    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];
                data.isAlert = (((evt[M.CalendarId.name] || '0') === 11) ? true : false);
                data.isTask = (((evt[M.CalendarId.name] || '0') === 12) ? true : false);
                data.isBirthDate = (((evt[M.CalendarId.name] || '0') === 8) ? true : false);
                return Ext.applyIf(data, evt);
            },
    
            getEventBodyMarkup: function () {
                if (!this.eventBodyMarkup) {
                    this.eventBodyMarkup = [
                        '<tpl if="isAlert">',
                            '<i class="ext-cal-ic-alert">&nbsp;</i>',
                        '</tpl>',
                        '<tpl if="isTask">',
                            '<i class="ext-cal-ic-task">&nbsp;</i>',
                        '</tpl>',
                        '<tpl if="isBirthDate">',
                            '<i class="ext-cal-ic-birthdate">&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;
            }
    
        });
  4. #4
    Hi Daniil...

    I am using the url property for pass the priority code... when the event is a task, i open another window instead of the EventWindow, so, the Url property will not be shown it code to user.

    You can close this thread, if you want...

    thanks for your help.
  5. #5
    I think you should also add the additional fields into EventMappings.
    <Ext.Net v2 sources root>\Build\Ext.Net\ux\calendar\src\data\EventMapp ings.js
  6. #6
    I'll leave it at that for now. If I need one more property, I will follow this example.

    Thanks a lot for your help.

    You can close this thread, if you want.

Similar Threads

  1. Replies: 1
    Last Post: Apr 30, 2012, 7:34 AM
  2. Replies: 4
    Last Post: Apr 25, 2012, 11:57 AM
  3. Replies: 8
    Last Post: Jul 04, 2011, 7:20 AM
  4. Replies: 9
    Last Post: Aug 14, 2010, 4:22 AM
  5. [CLOSED] [1.0] error: Can't find the property 'Items' in class 'Label'
    By PoloTheMonk in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 05, 2010, 7:07 AM

Posting Permissions