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

Filtering using dropdown

1 Answer 150 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 30 Mar 2016, 09:43 AM

I'm looking at an example in your mvc demo where you use checkboxes to filter events in a scheduler. I wish to implement a similar function but need to use a dropdown (due to the number of options). The code for the checkbox scenario is...

$("#people :checkbox").change(function(e) {
        var checked = $.map($("#people :checked"), function(checkbox) {
                return parseInt($(checkbox).val());});
                
var scheduler = $("#scheduler").data("kendoScheduler");
                
scheduler.dataSource.filter({
                        operator: function(task) {
                                return $.inArray(task.ownerId, checked) >= 0;
                       
}
                });
         });

How do I achieve similar (my dropdown values are strings) using a dropdown?

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 01 Apr 2016, 06:17 AM
Hello Jon,

When you sing the DropDownList you can simply modify the filter operator to compare current item resource field value with the DropDownList value (inside it's "change" event):

scheduler.dataSource.filter({
  operator: function(task) {
    return task.ownerId == ddlValue;
  }
});


Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Scheduler
Asked by
Jon
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or