0

Don't really know how to describe this question, but here goes. If you go to the Kendo Scheduler Demo page:-

http://demos.kendoui.com/web/scheduler/index.html

The checkboxes at the top filter the data, however if you clear the checkboxes the scheduler shows all data; I need it to show no data. Any ideas?

capgpilk
  • 85
  • 1
  • 8

1 Answers1

0

The example in that demo works by adding and removing filters to the Scheduler dataSource objects on checkboxes change event. To filter out all data, you can give an impossible condition to the filter object.

It isn't the optimum solution but I couldn't find another way to hide data.

to do so you can update the checkboxes' change eventhandler to be like this:

 ....

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

            var filter;
            if (checked.length == 0)
            {
                filter = {
                    logic:"and",
                    filters: [
                        {
                            operator: "eq",
                            field: "ownerId",
                            value: 1
                        }, {
                            operator: "neq",
                            field: "ownerId",
                            value: 1
                        }]
                };
            }
            else {
                var filter = {
                    logic: "or",
                    filters: $.map(checked, function(value) {
                        return {
                            operator: "eq",
                            field: "ownerId",
                            value: value
                        };
                    })
                };
            }

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

            scheduler.dataSource.filter(filter);
        });

 ....
Ahmad Ibrahim
  • 1,819
  • 2
  • 14
  • 26