I'm using an autocomplete with jquery 1.11.1 and ui of 1.11.2. In our autocomplete I have this code
}). data ( 'ui-autocomplete' ). _renderItem = function ( ul , item ) {
return $ ( '<li>' )
. data ( "item.autocomplete" , item )
. append ( "<a style='float:left; font-size:10px'><div class='divUIMultiColumn' style='width:100px'>" + item . firstname + "</div><div class='divUIMultiColumn' style='width:150px'>" + item . lastname + "</div>" + "<div class='divUIMultiColumn' style='width:50px'> " + item . ssn + "</div>" + "<div class='divUIMultiColumn' style='width:100px'>" + item . id + "</div></a>" )
. appendTo ( ul );
};
using this as well
open : cComboboxOpenApplicant ,
which has the code
function cComboboxOpenApplicant ( event ) {
var mComboboxOpenApplicant = '<li style="font-size:10px; padding-left:5px; padding-bottom:20px"><div class="divUIMultiColumnHeader" style="width:100px">First Name</div><div class="divUIMultiColumnHeader" style="width:150px">Last Name</div><div class="divUIMultiColumnHeader" style="width:50px">SSN</div><div class="divUIMultiColumnHeader" style="width:100px">ID</div></li></a>' ;
$ ( "ul.ui-autocomplete" ). prepend ( mComboboxOpenApplicant );
}
So what is happening is that we get rows back with data that are in 4 columns. Everything works as expected when you use the mouse. You can select the row you want and get the correct values. If you mouse over the header row, nothing gets selected. However, when you type in something into the autocomplete and use your down arrow on the keyboard, the first click down takes you to the header row and that gives you a unable to get property 'value' of undefined or null reference on the line for the ui.item.label in the
focus : function ( event , ui ) { //what populates the drop down
$ ( "[id$=txtApplicant]" ). val ( ui . item . label );
$ ( "[id$=hfApplicantID]" ). val ( ui . item . value );
return false ;
}
This error is happening in IE running on windows 8.1. Chrome seems to work fine. Have I missed something that should make this not happen. Any words of wisdom would be great.
Thanks
Shannon