Filtering using dropdown

2 posts, 0 answers
  1. Jon
    Jon avatar
    53 posts
    Member since:
    Oct 2013

    Posted 30 Mar Link to this post

    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?

  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 01 Apr Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
Back to Top