Filter Function Strange Results

Hello,
I have many problems to understand your framework. I try to use the Filter Function for Kanban. I have around 700 items in the Kanban board.

If I use:

        $$("searchtags").attachEvent("onChange", function(newv, oldv){
            
            $$("myBoard").filter(function(task){

                webix.message("Hallo");

               return tagString=newv; //checkTags(task.tags);
            });

        });

I runs through all the items. webix.message is shown 700 times.

If I use

        $$("searchtags").attachEvent("onChange", function(newv, oldv){
            //tagString = newv;
            $$("myBoard").filter(function(task){

                webix.message("Hallo");

                if(newv.length>0){
                    //Tagstring größer Null
                    if(newv.length>0 && newv.indexOf(",")==-1){
                        //TagString is größer null, hat aber kein Komma
                        if(task.tags.indexOf(newv)==-1){
                            return false;
                        }
                    }else{
                        //Tagstring ist größer null und hat Komma. Wir splitten
                        var tagSplittet = newv.split(",");
                        for(i = 0; i < tagSplittet.length; i++){
                            if(task.tags.indexOf(tagSplittet[i])==-1){
                                //Tag nicht gefunden als raus.
                                return false;
                            }
                        }
                    }
                }else{
                    return true;
                }

               return tagString=newv; //checkTags(task.tags);
            });

        });

The Message is thrown just 4 times. Please explain what I do wrong!

Solved. It seems that task.tags, that is in most cases a string, becomes undefined if the string is empty. So length and indexOf will become not valid.

Solution is: var tasktag = task.tags || ‘’;

I think it is not a good idea to change the typeof while working.