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

get data from filter object

2 Answers 39 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Rick Hubka
Top achievements
Rank 1
Rick Hubka asked on 24 Oct 2017, 05:46 PM

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 Answers, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 26 Oct 2017, 11:34 AM
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.
0
Rick Hubka
Top achievements
Rank 1
answered on 26 Oct 2017, 12:54 PM

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

Tags
Scheduler
Asked by
Rick Hubka
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Rick Hubka
Top achievements
Rank 1
Share this question
or