Two filter at the same Time !

2 posts, 0 answers
  1. blackout
    blackout avatar
    68 posts
    Member since:
    Feb 2020

    Posted 20 May Link to this post

    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 ...

  2. blackout
    blackout avatar
    68 posts
    Member since:
    Feb 2020

    Posted 22 May in reply to blackout Link to this post

    Hello,

    for the people who still searching ..

    i found my answer here ..

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

Back to Top