get data from filter object

3 posts, 0 answers
  1. Rick Hubka
    Rick Hubka avatar
    42 posts
    Member since:
    Apr 2006

    Posted 24 Oct 2017 Link to this post

    Hi.  I have a filter in place and I change it at times in js like this.

    var ds = $("#scheduler").data("kendoScheduler").dataSource;
               ds.filter([
                   {
                       "logic": "or",
                       "filters": [
                           {
                               "field": "OwnerID",
                               "operator": "eq",
                               "value": 1
                           },
                           {
                               "field": "OwnerID",
                               "operator": "eq",
                               "value": 2
                           },
                           {
                               "field": "OwnerID",

    In my popup custom edit window I have a dropdown with OwnerID values 1 to 8.

    I want the dropdown to show only one default value if my filter is for only 1 value.

    My problem is how to read/get data from the current filter.

    function filterdata() {
            var scheduler = $("#scheduler").data("kendoScheduler");
            var dataSource = scheduler.dataSource;
            var filters = dataSource.filter();
            alert(filters);  //  this returns the the text "Object"
     
     
          return {
                dept: 2
          };
        }

     

    So...  How can I get and check the array values of the filter object?

    Thanks

     

  2. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    1221 posts

    Posted 26 Oct 2017 Link to this post

    Hello Rick,

    What you have done is actually the appropriate approach for retrieving the Scheduler DataSource filter. The alert displays "[object Object]" because this is the default result returned from the toString() method of the object. All the loaded filter options could be retrieved from the filters field of that object:
    var scheduler = $("#scheduler").data("kendoScheduler");
    var dataSource = scheduler.dataSource;
    var filter = dataSource.filter();
    var filters = filter.filters;
    var filtersString = '';
     
    for (var i = 0; i < filters.length; i ++ ) {
        filtersString += (' ' + filters[i].value + ';');
    }
     
    alert('Filters:' + filtersString);

    Regards,
    Veselin Tsvetanov
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Rick Hubka
    Rick Hubka avatar
    42 posts
    Member since:
    Apr 2006

    Posted 26 Oct 2017 in reply to Veselin Tsvetanov Link to this post

    That is exactly what I needed.
    Thank you so much!!!!!!

Back to Top