Reputation: 41
I'm trying to display images with labels in jQuery UI Autocomplete.
I got stuck at the error
jquery-ui.js:6853 Uncaught TypeError: Cannot read property 'value' of undefined".
However, during my investigation, it turned out that the problem is in overriding _renderItem
function - whatever I do in its overridden implementation, I see the same error, even if I define it by just copying code from jQuery UI source code.
I tried jQuery UI versions 1.10.4 1.11.4 and 1.10.2 and the problem still exists.
I think that I've already tried almost everything, even making really silly versions of autocomplete, but still, every time I do something with _renderItem
implementation, the error occurs.
According to the source code of jQuery UI, the reason for this error is a lack of ui-autocomplete-item
data, but I do send it, so I've got no idea what I'm doing wrong.
Upvotes: 1
Views: 475
Reputation: 2255
this is for jQuery 1.10.2
var autoComObj = $("#id").autocomplete({
minLength : 3,
width : 590,
scroll : true,
scrollHeight : 250,
matchContains : true,
autoFill : false,
cacheLength : 1,
source:function(request,response){//some code },
select:function(event,ui){//selection code }
});
autoComObj.data("ui-autocomplete")._renderItem=function(ul, item){//custom renderItem code. }
Upvotes: 0