Opened 7 years ago

Closed 7 years ago

#9321 closed bug (notabug)

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&nbsp;---&nbsp" + 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.

Change History (1)

comment:1 Changed 7 years ago by Scott González

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.

Note: See TracTickets for help on using tickets.