Skip to main content

Search and Top Navigation

#7576 closed bug (notabug)

Opened July 22, 2011 01:22PM UTC

Closed July 22, 2011 01:32PM UTC

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:
Description

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

$('.myclass').autocomplete....
.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>" )
			.appendTo(ul);
	};

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

Attachments (0)
Change History (1)

Changed July 22, 2011 01:32PM UTC by scottgonzalez comment:1

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.