EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: aswzen on December 30, 2015, 03:54:39 AM



Title: Combobox search word in middle of text/string
Post by: aswzen on December 30, 2015, 03:54:39 AM
I see the combobox only search value with prefix system..

How to make that able to find words in middle of string?
sample: open this http://www.jeasyui.com/demo/main/index.php?plugin=ComboBox&theme=default&dir=ltr&pitem=
then put wors "kota"
then we have no result..
although there are city that including word "kota"..that is Dakota

Thank you in advance



Title: Re: Combobox search word in middle of text/string
Post by: stworthy on December 30, 2015, 09:12:52 AM
Please override the 'filter' function to define your customized filter rule.
Code:
$('#cc').combobox({
filter: function(q, row){
var opts = $(this).combobox('options');
return row[opts.textField].toLowerCase().indexOf(q.toLowerCase()) >= 0;
}
});


Title: Re: Combobox search word in middle of text/string
Post by: aswzen on December 30, 2015, 07:51:39 PM
okay its works :)

thank you

http://jsfiddle.net/aswzen/9geyLroz/