Get Resource From Scheduler Click

4 posts, 1 answers
  1. Reafidy
    Reafidy avatar
    17 posts
    Member since:
    Sep 2014

    Posted 05 Jul Link to this post

    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);?????

                    }

         });

  2. Answer
    Ivan Danchev
    Admin
    Ivan Danchev avatar
    1264 posts

    Posted 10 Jul Link to this post

    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.
  3. Reafidy
    Reafidy avatar
    17 posts
    Member since:
    Sep 2014

    Posted 11 Jul Link to this post

    Thanks Ivan.  I also used the:

    scheduler.resourcesBySlot(slot);
  4. Ivan Danchev
    Admin
    Ivan Danchev avatar
    1264 posts

    Posted 11 Jul Link to this post

    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.
Back to Top