when i write first letter it shows all the data which contains that particular letter and it's also case sensitive all irrelevant suggestions. I am trying to sort the suggestion with in-built sorter function. My code snippet is given below,
var autoComplete = $('#repository').typeahead({
autoSelect: true,
sorter:function(repoNames, b) {
//get input text
var InputString= $("#repository").val();
//move exact matches to top
if(InputString == a.value){ return -1;}
if(InputString == b.value){return 1;}
//close match without case matching
if(InputString.toLowerCase() == a.value.toLowerCase()){ return -1;}
if(InputString.toLowerCase()== b.value.toLowerCase()){return 1;}
if( (InputString != a.value) && (InputString != b.value)){
if (a.value < b.value) {
return -1;
}
else if (a.value > b.value) {
return 1;
}
else return 0;
}
},
afterSelect: function() {
$("#get-stats-button").click();
}
});
Now the thing i can't understand is what the heck the functions parameters will be ? what is a and b ?
when i write first letter it shows all the data which contains that particular letter and it's also case sensitive all irrelevant suggestions. I am trying to sort the suggestion with in-built sorter function. My code snippet is given below,
Now the thing i can't understand is what the heck the functions parameters will be ? what is
a
andb
?