Select2 4.0 Issue with case insensitive searching with tags mode enabled

1,010 views
Skip to first unread message

mihirp...@gmail.com

unread,
May 1, 2015, 5:28:09 AM5/1/15
to sel...@googlegroups.com
I want to implement tagging with select2 so i created a dropdownlist with the values. Lets say I have just 1 tag "A1" in db.
When I type "A1" then the value searched below will be highlighted. Working fine as expected but when I type "a1" then there are two values in dropdown. one is the text we searched "a1" and 2nd is "A1".
Now I want to make the search case insensitive and also if i search "a1" then "A1" which is 1st value of dropdown should be selected instead of showing the search result above the actual result.

$("#contenttags").select2({
tags: true,
placeholder: 'Select',
matcher: function (params, data) {
if ($.trim(params.term) === '') {return data;}
if (data.text.toUpperCase().indexOf(params.term.toUpperCase()) > -1) {var modifiedData = $.extend({}, data, true);return modifiedData;}
return null;
}

I tried to find a solution but can someone help me fix it to tell me how can I do it. I have also attached images.
Expected.png
Happening.png

mihirp...@gmail.com

unread,
May 1, 2015, 5:34:41 AM5/1/15
to sel...@googlegroups.com, mihirp...@gmail.com
1)There are two values in selected tags "a1" and "A1". This should not happen. Both are basically same tag.

2) Also at present it doesn't seem that a tag is removed once it is selected. How can this be achieved too ??

Thank you in advance community ;)
Multiselect.png
Reply all
Reply to author
Forward
0 new messages