Custom filter for combo

安稳与你 提交于 2020-01-04 04:13:05

问题


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:


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;
        },
    }
});


来源:https://stackoverflow.com/questions/23151108/custom-filter-for-combo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!