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

Get Resource From Scheduler Click

3 Answers 352 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Reafidy
Top achievements
Rank 2
Iron
Reafidy asked on 06 Jul 2017, 02:03 AM

How do I get the resource (RoomID) from an associated click event:

      var scheduler = $("#scheduler").data("kendoScheduler");
      scheduler.wrapper.on("click touchend", " .k-scheduler-content td", function (e) {
      var slot = scheduler.slotByElement(e.originalEvent.target);
                if (slot) {
                    alert(slot.startDate);
                    alert(slot.endDate);
                    alert(slot.resources.RoomID);?????

                }

     });

3 Answers, 1 is accepted

Sort by
0
Accepted
Ivan Danchev
Telerik team
answered on 10 Jul 2017, 02:26 PM
Hello Reafidy,

In order to get the resource from the clicked slot you first need to enable grouping:
group: {
  resources: ["Rooms"],
  orientation: "vertical"
}

If you don't use grouping the slots will not be associated with a resource.

Once grouping is enabled the slots will get a groupIndex property (slot.groupIndex), which you can use to get the resource data (text, value) from the Scheduler's resources data source, as shown in this dojo example.

Regards,
Ivan Danchev
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Reafidy
Top achievements
Rank 2
Iron
answered on 11 Jul 2017, 07:05 AM

Thanks Ivan.  I also used the:

scheduler.resourcesBySlot(slot);
0
Ivan Danchev
Telerik team
answered on 11 Jul 2017, 07:36 AM
Hello Reafidy,

Yes, the Scheduler's resourcesBySlot method is a good alternative to getting the resources data from the data source.

Regards,
Ivan Danchev
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Scheduler
Asked by
Reafidy
Top achievements
Rank 2
Iron
Answers by
Ivan Danchev
Telerik team
Reafidy
Top achievements
Rank 2
Iron
Share this question
or