This is a migrated thread and some comments may be shown as answers.

How to "activate" recurrenceeditor in add form?

3 Answers 161 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 25 Feb 2016, 04:47 PM

So I have the recurrence editor in my edit form, and it works as its included with the code: 

<div class="k-edit-label"><label for="recurrenceRule">Repeat</label></div>
 
            <div data-container-for="recurrenceRule" class="k-edit-field">
              <div data-bind="value:recurrenceRule" name="recurrenceRule" data-role="recurrenceeditor"></div>
            </div>

And activated with the script:

editable: {
            template: $("#editorx").html()
        }

 

Is this possible in a custom add form? I have found no reference in the documentation on how to created kendo type templates for the add forms, only edit.

 

Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 29 Feb 2016, 09:00 AM
Hi Andrew,

From the provided information it's not clear for us what exactly you are trying to achieve - could you please elaborate more on this? Also if possible please provide the full Scheduler configuration in order to get better overview of the current setup that you have. 

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Andrew
Top achievements
Rank 1
answered on 15 Mar 2016, 04:37 PM

My goal is simple: construct an add event form that uses the Scheduler's recurrence editor.

Here is my configuration:

$("#scheduler").kendoScheduler({
        date: new Date(),
        startTime: new Date(),
        height: 750,
        eventTemplate: $("#event-template").html(), //kendo.template(eventTemplateString), //$("#event-template").html(),
        editable: {
            template: $("#editorx").html()
        },
        add: scheduler_add,
        //editable: false,
        dataBound: function(e) {
            if (!dangLoad) {
                dangLoad = true;//wut? ok Brenden. DANGLOAD
 
                hideEvent();
            }
            //console.log(e);
            var scheduler = this;
            var view = scheduler.view();
 
            view.table.find("td[role=gridcell]").each(function() {
 
                var element = $(this);
                var slot = scheduler.slotByElement(element);
                if (slot.startDate < new Date) {
                    element.addClass("greyCell");
                }
 
            });
            $("#scheduler").kendoTooltip({
                filter: ".k-event",
                position: "top",
                width: 250,
                content: kendo.template($('#templatezz').html())
                    //content: "Tooltip content"
            });
        },
        change: function(e) {
 
            console.log("Changing.");
 
            if (user.role == "read-only") {
                console.log("You can not execute this action from a read-only account");
                e.preventDefault();
                return 1;
            }
 
            console.log('change');
            if (e.event.result == 'Manual') {} else {
                alert("cannot change " + e.event.case_name + " as it was created in Access");
                e.preventDefault();
            }
            //e.preventDefault();
            //console.log("Editing", e.event.title);
        },
        edit: function(e) {
 
            this.one("save", function () {
                console.log("saving: \n");
                console.log(e);
                e.preventDefault();
            });
 
            if (user.role == "read-only") {
                alert("You can not perform this action from a read-only account");
                e.preventDefault();
                showReadOnlyModal(e.event);
                return 1;
            }
 
            console.log(meds);
            console.log(e.event.created_by);
 
            if (user.role == "mediator") {
                editRights = _.contains(meds, e.event.created_by);
            } else {
                editRights = !_.contains(meds, e.event.created_by); //Admins edit everything not created by a mediator.
            }
 
            console.log("edit rights: " + editRights);
 
            if (e.event.created_by == "SOL Converter") {
                console.log("Created by SOL Converter");
                editRights = false;
            }
 
            if (!editRights) {
                 
                //alert("You do not have the right to edit this entry.");
                showReadOnlyModal(e.event);
                e.preventDefault();
                return 1;
            }
 
            console.log("editing");
 
            var addr, body, subject; //For automated emails.
                addr = "";
            console.log(e.event.mediatorIds);
            e.event.last_updated = Date();
            e.event.last_updated_by = Cookies.get("name");
             
            if (e.event.result == 'Manual') {
                console.log(e.event);
                var getInfoPromise = getWhoCreatedModified(e.event._id);
                console.log(e.event._id);
                getInfoPromise.then(onGetWhoCreatedModifiedComplete, onErrorFunction);
 
            } else {
                showPartyInfoModal(e.event.parties, e.event.description, e.event.caseNumber, e.event);
                e.preventDefault();
            }
        },
        remove: function(e) {
            if (user.role == "mediator") {
                editRights = _.contains(meds, e.event.created_by);
            } else {
                editRights = !_.contains(meds, e.event.created_by); //Admins edit everything not created by a mediator.
            }
 
            console.log("edit rights: " + editRights);
 
            if (user.role == "read-only") {
                console.log("You can not execute this action from a read-only account");
                e.preventDefault();
                return 1;
            }
 
            if (e.event.result == 'Manual') {
                console.log("hey you try and remove");
                console.log(e);
 
                var meetingToDelete = e.event._id;
                var deleteEntryPromise = deleteEntry(meetingToDelete);
                deleteEntryPromise.then(onDeleteEntryComplete, onErrorFunction);
 
            } else {
                alert("cannot remove " + e.event.case_name + " as it was created in Access");
                e.preventDefault();
            }
            //e.preventDefault();
            //console.log("Editing", e.event.title);
        },
        //editable: editRights,
        views: [{
                    type: "day"
                }, {
                    type: "workWeek"
                }, {
                    type: "month",
                    selected: true,
                    eventHeight: 35
                }, {
                    type: "agenda"
                }
            /*, {
                                type: "timeline"
                            }, {
                                type: "timelineWorkWeek"
                            }, {
                                type: "timelineMonth"
                            }*/
        ],
        timezone: "Etc/UTC",
        dataSource: {
            //data: scheduleDataz,
            transport: {
                read: {
                    //url: "getData.pl?ACTION=GETMEETINGS", //node rewrite
                    url: "/meetings",
                    dataType: "JSON" // "jsonp" is required for cross-domain requests; use "json" for same-domain requests
                },
                update: {
                    url: "/meeting", //node rewrite
                    dataType: "JSON",
                    type: "POST",
                    contentType: "application/json; charset=utf-8"
                },
                //last_updated, last_updated_by
                destroy: {
                    url: "/deleteMeeting",
                    dataType: "JSON",
                    type: "POST",
                    contentType: "application/json; charset=utf-8"
                },
                parameterMap: function (data, op) {
                    return JSON.stringify(data);
                }
            },
            requestEnd: function(e) {
                //check the "response" argument to skip the local operations
                if (e.type === "read" && e.response) {
                    console.log("Current request is 'read'.");
                    console.log(e.response);
                }
              },
            schema: {
                parse: function (res) {
                    var meetings = [];
                    for (var i = 0; i < res.length; i++) {
                        var meet = res[i];
                        meet.start_time = new Date(meet.start_time);
                        meet.end_time = new Date(meet.end_time);
                        meetings.push(meet);
                    }
                    return meetings;
                },
                data: function (data) {
                    console.log(data);
                    if (data.length == 0) {
                        return [];
                    }
                    return data;
                },
                model: {
                    id: "MeetingID",
                    fields: {
                        MeetingID: {
                            from: "meeting_id"
                        },
                        title: {
                            from: "case_name",
                            defaultValue: "No title",
                            validation: {
                                required: true
                            }
                        },
                        start: {
                            type: "date",
                            from: "start_time"
                        },
                        end: {
                            type: "date",
                            from: "end_time"
                        },
                        description: {
                            from: "case_desc"
                        },
                        caseManager: {
                            from: "case_manager",
                            nullable: true
                        },
                        mediatorIds: {
                            from: "mediator_LawyerIDs"
                        },
                        result: {
                            from: "meeting_result",
                            nullable: true
                        },
                        caseNumber: {
                            from: "case_number",
                            nullable: true
                        },
                        case_location: {
                            from: "location",
                            nullable: true
                        },
                        parties: {
                            from: "parties",
                            nullable: true
                        },
                        numParties: {
                            from: "number_of_parties",
                            nullable: true
                        },
                        created_by: {
                            from: "created_by",
                            nullable: true
                        },
                        creation_timestamp: {
                            from: "creation_timestamp",
                            nullable: true
                        },
 
                        //Recurrence specific fields
                        recurrenceId: {
                            from: "RecurrenceId"
                        },
                        recurrenceRule: {
                            from: "RecurrenceRule"
                        },
                        recurrenceException: {
                            from: "RecurrenceException"
                        }                       
                    }
                }
            }
        },
        resources: [{
            field: "result",
            title: "Meeting Result",
            dataSource: [{
                text: "_",
                value: "Manual",
                color: "#661155"
            }, {
                text: "Canceled",
                value: "Canceled",
                color: "#CCCCCC"
            }, {
                text: "Settled",
                value: "Settled"
            }, {
                text: "Not settled",
                value: "Not settled"
            }, {
                text: "Settled Without Mediation",
                value: "Settled w/o Mediation"
            }]
        }, {
            field: "mediatorIds", // The field of the scheduler event which contains the resource identifier
            title: "Mediator", // The label displayed in the scheduler edit form for this resource
            dataSource: mediatorResources,
            multiple: true
        }]
    });

0
Vladimir Iliev
Telerik team
answered on 17 Mar 2016, 09:03 AM
Hello Andrew,

It' still not clear for me what is the desired behavior that you need, however if you need to have different edit and create templates than you can include all editors in current edit template and hide parts of it using the "edit" event of the Scheduler:


Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Scheduler
Asked by
Andrew
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Andrew
Top achievements
Rank 1
Share this question
or