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

Two filter at the same Time !

1 Answer 13 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
K.Ramadan
Top achievements
Rank 2
Veteran
K.Ramadan asked on 20 May 2020, 03:07 PM

Hello,

I'm trying to make a filter with two filters inside .. !!

I have a MultiSelect and AutoComplete and I want to take the value of them and put them in a filter...

so what I did is this...

in onChange_MultiSelect I wrote this...

var filter = {
 
               logic: "or",
               filters: new Array()
           };
           Global_Selected_Mitarbeiter_Filter = {
               logic: "or",
               filters: filter.filters
           };
 
           scheduler.dataSource.filter(filter);
           DataItems.forEach(function (item, index) {
              // var itemToAdd =
             //  {
                //   Text: item.CrmUserNameZuordnung,
                 //  Value: item.ID
              // };
              // selected.push(itemToAdd)
 
               //for (var i = 0; i < selected.length; i++) {
               for (var i = 0; i < DataItems.length; i++) {
 
                   filter.filters.push({
                       field: "CrmUserName",
                       operator: "eq",
                       value: DataItems[i].CrmUserNameZuordnung
                   });
               }
           })

 

and in onChange_AutoComplete i wrote this ..

var filter_All = {
 
     logic: "and",
     filters: new Array()
 };
 var filter = {
 
     logic: "or",
     filters: new Array()
 };
 if (auto_Change.value() != "") {
     filter_All.filters.push(filter);
 }
 if (Mitarbeiter_MSelect.value() != "") {
     filter_All.filters.push(Global_Selected_Mitarbeiter_Filter);
 }        
 scheduler.dataSource.filter(filter_All);
 DataItemss.forEach(function (item, index) {
   //  var itemToAdd =
   //  {
    //     Text: item.Title
         //Value: item.Title
         //Color    : item.color
    // };
   //  selected.push(itemToAdd)
 
     //for (var i = 0; i < selected.length; i++) {
      
     for (var i = 0; i < DataItemss.length; i++) {
 
             filter.filters.push({
                 //2- this the title of the field of the multiselect it self .. like what to show as title for these fields
                 field: "title",
                 operator: "startswith",
                 //value: selected[i].Text
                 value: DataItemss[i].Title
             });
         }
 })

 

so basically what I did is, putting the value in two filters and then push them into a third filter and try to filter the Scheduler... 

but it's not working .. is there another way to approach this goal .. or any tip to make it right ??

Thanks in advance ...

1 Answer, 1 is accepted

Sort by
0
K.Ramadan
Top achievements
Rank 2
Veteran
answered on 22 May 2020, 08:03 AM

Hello,

for the people who still searching ..

i found my answer here ..

https://www.telerik.com/forums/multiple-filter-conditions#_EfieB9PgUSJJypDpCT0fA

Tags
Scheduler
Asked by
K.Ramadan
Top achievements
Rank 2
Veteran
Answers by
K.Ramadan
Top achievements
Rank 2
Veteran
Share this question
or