Opened 12 years ago

Closed 12 years ago

#7576 closed bug (notabug)

custom template is only rendered for first input-field with class-selector

Reported by: Anticom Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.autocomplete Version: 1.8.14
Keywords: Cc:
Blocked by: Blocking:


when using a remote jsonp data-source and assigning the autocomplete using

.data("autocomplete")._renderItem = function( ul, item ) {
			return $( "<li></li>" )
			.data( "item.autocomplete", item )
			.append( "<a>" + item.label + "<br><font color='grey'>" + item.myElement + "</font></a>" )

the custom template only gets assigned to the first input-field instead of to all of them.

Change History (1)

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

Resolution: invalid
Status: newclosed

That's because you're modifying the _renderItem method on the first instance (getters like .data() always only return a value for the first element). Use .each() to iterate over all elements. If you need more help, please use the forums.

Note: See TracTickets for help on using tickets.