When I search the user name in the search box of autocomplete by using the first letter of the user name. Its not showing any names. When I enter the second letter its showing the names. But when I erase the second letter of the name and its showing the names with the single letter.
Here are the code I'm using:
keyUp: function (e) {
var inputFieldName = this.name;
var inputFieldValue = this.value;
console.log(inputFieldName);
console.log(inputFieldValue);
var autocompletedata='';
if(inputFieldValue != undefined){
if(inputFieldName==='checkedoutuser' && inputFieldValue.length >= 1) {
var inputFieldValue = this.value;
Vsuite.services({
service:'searchsuggestion',
async: false,
type: 'get',
json: true,
data: {
facetValue: inputFieldValue,
resultSetLimit: 20
}
}).done(function (responseData) {
console.log(responseData);
var checkedOutId = $('.repeat-instance input[name="'+inputFieldName+'"]').attr('id');
this.setProperties({
autocompletedata: responseData,
});
console.log(autocompletedata);
console.log(responseData);
$('#'+checkedOutId).autocomplete({
source: responseData,
delay: 1000,
minLength: 1,
open: function () {
console.log($('#autocomplete-add-refine').length)
console.log(checkoutUserList.length)
if ($('#autocomplete-add-refine').length == 0 && checkoutUserList.length >= 5) {
$('<li id="autocomplete-add-refine"><b>Continue typing to refine further</b> </li>').appendTo('ul.ui-autocomplete');
console.log($('#autocomplete-add-refine').length);
$('ul.ui-autocomplete').css({
'max-height': '120px',
'overflow-y': 'auto',
'overflow-x': 'hidden'
});
}
else {
$('#autocomplete-add-refine').remove();
}
}
if($('#autocomplete-add-refine').length > 0 && checkoutUserList.length <=20) {
$('#autocomplete-add-refine').remove();
}
});
}.bind(this));
}
else {
Ember.run.later(this, function () {
this.$().change();
}, 125);
}
}
},
I need the search names needs to come when I enter the single letter of the name on the first time itself. Your help will be appreciate. I'm using Ember 1.4.0.
Aucun commentaire:
Enregistrer un commentaire