1
votes

I'm using the open source Kendo Scheduler with ASP.NET MVC. I display some meeting rooms and the users are able to make bookings to these if they want to. Now because off the large amount of rooms, users are able to filter the rooms displayed in the scheduler.

I'm currently using a function like this:

   $(document).ready(function () {
       $("#btnFilter").click(function () {
           $("#scheduler").data().kendoScheduler.resources[0].dataSource.filter({ field: "text", operation: "eq", value: "K15.25" });
           $('#scheduler').data().kendoScheduler.view($('#scheduler').data().kendoScheduler.view().name);

       });
   });

With this function I can filter the scheduler on only 1 room: "K15.25". But I want to filter the scheduler on multiple rooms like: "K15.25" AND "K16.30" AND "K16.31" AND ... I imagine that this is possible and can't be so hard to do but I can't find a proper solution?

1

1 Answers

0
votes

Here, We are filtering the resource based on the selection, "checked" variable will be the collection of selected resource

              var scheduler = $("#scheduler").data("kendoScheduler");

              var checked = $.map($("#people :checked"), function (checkbox) {
                  return parseInt($(checkbox).val());
              });

              var filter = {
                  logic: "or",
                  filters: $.map(checked, function (value) {
                      return {
                          operator: "eq",
                          field: "ResourceId",
                          value: value
                      };
                  })
              };

              //filter the resource data source
              console.log("filter", filter);
              scheduler.resources[0].dataSource.filter(filter);
              scheduler.view(scheduler.view().name);