Closed brinal-dm closed 8 years ago
Hi Nick,
I have found the solution.
I have added below piece to select2 item to sort as needed:
sorter: function(results) {
var query = $(''.select2-search_field'').val().toUpperCase();
query = query.replace(/ /g,'''')
var c,d;
return results.sort(function(a, b) {
c = a.text.replace(/ /g,'''').toUpperCase().indexOf(query);
d = b.text.replace(/ /g,'''').toUpperCase().indexOf(query);
if (c<0)
c= c-1;
else
c= c1;
if(d<0)
d=d-1;
else
d=d_1;
return c - d; });
}
This works for now. Thanks once again for integrating select2 plugin in apex.
Hi Nick,
Is there a way that I can list the option that matched with my search term first in drop down list or say rather arrange the values in drop down list in order that I enter in my search term?
For eg: search term = 'hnwe 34' and LOV consists of
Then list the drop down value starting with hnwe 34 first and all the other options later on. So in this case the order will alphabetical based on search term like below: hnwe 34 best hnwe 34 stan for rl 123233 hnwe test
Is it something I can do easily or needs to update plugin?