Bootstrap typeahead making uppercase insensitive? -
i using parameter make bootstrap typeahead search in insensitive case mode.
matcher: function(item) { return true }
i works accents typing "e" searches é,è,ë,ê etc... not work upper lower case => typing "g" doesn't "g"...
is there other parameter?
ok here did using paul's solution :
matcher: function(item) { if (item.tolowercase().indexof(this.query.trim().tolowercase()) != -1) { return true; } if (item.touppercase().indexof(this.query.trim().touppercase()) != -1) { return true; } var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&'); query = query.replace(/a/ig, '[a\341\301\340\300\342\302\344\304]'); query = query.replace(/e/ig, '[e\351\311\350\310\352\312\353\313]'); query = query.replace(/i/ig, '[i\355\315\354\314\356\316\357\317]'); query = query.replace(/o/ig, '[o\363\323\362\322\364\324\366\326]'); query = query.replace(/u/ig, '[u\372\332\371\331\373\333\374\334]'); query = query.replace(/c/ig, '[c\347\307]'); if(item.tolowercase().match(query.tolowercase())){ return true; } }
with this, have real insensitive case. putted main special characters. may want add characters match.
Comments
Post a Comment