Group/Resource ID on Drag and Drop

2 posts, 0 answers
  1. Marshall Jones
    Marshall Jones avatar
    5 posts
    Member since:
    Jul 2009

    Posted 28 Oct 2014 Link to this post

    I'm using the following code to drag and drop from a grid to the Scheduler:

    function createDropArea(scheduler) {
            scheduler.view().content.kendoDropTargetArea({
                filter: ".k-scheduler-table td, .k-event",
                drop: function (e) {
                    var grid = $("#grid").data("kendoGrid");
                    var scheduler = $("#scheduler").data("kendoScheduler");
                   
                    var offset = $(e.dropTarget).offset();
                   
                    var slot = scheduler.slotByPosition(offset.left, offset.top);
                    var dataItem = grid.dataItem(grid.select());
                    alert(slot.);

                    if (dataItem && slot) {
                        var offsetMiliseconds = new Date().getTimezoneOffset() * 60000;
                        var newEvent = {
                            title: dataItem.Title,
                            end: new Date(slot.startDate.getTime() + (dataItem.end - dataItem.start)),
                            start: slot.startDate,
                            isAllDay: slot.isDaySlot,
                            description: dataItem.ID,
                            ResourceID: '1'
                        };

                        //delete current event:
                        grid.dataSource.remove(dataItem);
                        grid.dataSource.sync();
                        grid.dataSource.read();

                        //Save the new event and sync it with server:
                        scheduler.dataSource.add(newEvent);
                        scheduler.dataSource.sync();
                    }

                }
            });
        }

    How can I get the Group/Resource ID?  Can I get it from the Slot or Element?
  2. Marshall Jones
    Marshall Jones avatar
    5 posts
    Member since:
    Jul 2009

    Posted 29 Oct 2014 Link to this post

    I figured it out by using:

    var resouce = scheduler.resourcesBySlot(slot);
Back to Top