Search code examples
schedulerdhtmlx

DHTMLX Recurring Events in MVC3


I was using DHTMLX Scheduler in my MVC3 project. I need to use Recurring events scheduler. All the configurations seems fine except DB. I need to know what are the necessary fields i need to include on the server for recurring events.

And How about the xml configuration and data retrieval for the recurring events. In that sample tutorial consist of server end code as in php. So i can't come to know how to write code for MVC environment. Pls guide me how can i do this.

Index

function init() {
    scheduler.templates.event_text = function (start, end, ev) {
        return 'Event: ' + ev.Description + '';
    };
    scheduler.templates.calendar_month = scheduler.date.date_to_str("%F %Y");
    scheduler.config.full_day = true;
    scheduler.locale.labels.full_day = "Full day";
    //week label of calendar
    scheduler.templates.calendar_scale_date = scheduler.date.date_to_str("%D");
    //date value on the event's details form
    scheduler.templates.calendar_time = scheduler.date.date_to_str("%d-%m-%Y");
    scheduler.config.repeat_date = "%m-%d-%Y";

    scheduler.config.update_render = "true";
    scheduler.locale.labels.section_category = 'Category';
    scheduler.locale.labels.section_location = 'Title';

    scheduler.config.lightbox.sections = [
    { name: "location", height: 15, map_to: "title", type: "textarea" },
{ name: "description", height: 50, map_to: "text", type: "textarea", focus: true },

    { name: "recurring", height: 115, type: "recurring", map_to: "rec_type", button:  "recurring" },

{ name: "time", height: 72, type: "time", map_to: "auto" },
    { name: "category", height: 22, type: "select", map_to: "category", options: [
    {key:"", label:"Select Category"},
    {key:"A", label:"Public"},
    {key:"P", label:"Private"},
    {key:"C", label:"Closed"}
           ]}

            ]


           scheduler.config.xml_date = "%m/%d/%Y %H:%i";
           scheduler.init("scheduler_here", new Date(), "month");
           scheduler.load("/Admin/EventCalendar/Dat");
           var dp = new dataProcessor("/Admin/EventCalendar/Save");
           dp.init(scheduler);
           dp.setTransactionMode("POST", false);
           }

Thanks.


Solution

  • You need to define 4 field for related record in DB

    • rec_type, will be week_1___6 ( each week, on Sunday )
    • start_date - first date of occurence
    • end_date - last date of occurence ( set it to year 9999 if event has not end date )
    • event_length - length of events in seconds, will be 36600 in you case