Custom filter for combo

2019-07-01 12:07发布

I'm using Webix UI It allows to define the combo control like next

webix.ui({ view:"combo", options:["One", "Two", "Three"] });

It works fine, except of one moment. By default combo filters data by stat of text ( after typing "o", combo list will show only "One" option). How I need to change the above code to use full text filtering ( typing "o" must whow both "One" and "Two" options, as both of them contains the letter "o" )

1条回答
手持菜刀,她持情操
2楼-- · 2019-07-01 12:41

You can define a custom filtering method as part of options object

webix.ui({
    view:"combo",
    options:{
        data:["One", "Two", "Three"],
        filter:function(obj, filter){
            //obj - combo option
            //filter - current text in combo control
            return obj.value.indexOf(filter) != -1;
        },
    }
});
查看更多
登录 后发表回答