Skip to main content

Search and Top Navigation

#9321 closed bug (notabug)

Opened May 22, 2013 03:49PM UTC

Closed May 22, 2013 04:43PM UTC

Autocomplete not works wtih $.ui.autocomplete.prototype._renderMenu method overriding

Reported by: jayesh16285 Owned by:
Priority: minor Milestone: none
Component: ui.autocomplete Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:
Description

I have been using following method for autocomplete.

$("#inputId").autocomplete(

{

source : function(request, response) {

if($.trim($(this.element).val())==""){

return;

}

$.ui.autocomplete.prototype._renderMenu = function(ul, items) {

var self = this;

ul

.append("<li><table><tr><td style='width:150px; font-weight:bold;'>Catalog</td><td style='font-weight:bold'>Description</td></tr></table></li>");

$.each(items, function(index, item) {

self._renderItem(ul, item);

});

};

$.getJSON( "/servletName", {

query : $.trim($(this.element).val()),

action: "parameter"

}, response);

},

minLength : 1,

select : function(event, ui) {

$("#inputId").val(ui.item.desc);

$("#inputId1").val(ui.item.label);

return false;

}

}).data("autocomplete")._renderItem = function(ul, item) {

return $("<li></li>").data("item.autocomplete", item)

//.append( "<a><span style='padding-right:" + (10-item.label.length ) + "px;'>" + item.label + "</span>1 --- " + item.desc + "</a>" )

.append(

"<a><table><tr><td style='width:150px;'>" + item.label

+ "</td><td>" + item.desc

+ "</td></tr></table></a>").appendTo(ul);

};

But with jQuery UI 1.10.3 it gives me error $.ui.autocomplete.prototype._renderMenu not defined.

Then I use Jquery ui 1.7 and its works fine.

Attachments (0)
Change History (1)

Changed May 22, 2013 04:43PM UTC by scottgonzalez comment:1

resolution: → notabug
status: newclosed

Autocomplete didn't exist in 1.7 and there are some serious problems with this code. Please ask for help on the forums or Stack Overflow.