Skip to main content

Search and Top Navigation

#8584 closed bug (notabug)

Opened September 18, 2012 02:23PM UTC

Closed October 05, 2012 12:36AM UTC

auto complete render item prolem if apply to multi element

Reported by: deng.hui5 Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.autocomplete Version: 1.9.0-rc.1
Keywords: Cc:
Blocked by: Blocking:
Description

the following sample code doesn't render as expected

	$( "#A, #B, #C, #D" ).autocomplete({
		minLength: 0,
		source: ...,
		focus: ...,
		select: ...
	}).data( "autocomplete" )._renderItem = function( ul, item ) {
		return $( "<li></li>" )
			.data( "item.autocomplete", item )
			.append( "<a>" + item.code + ": " + item.description + "</a>" )
			.appendTo( ul );
	};
Attachments (0)
Change History (2)

Changed September 18, 2012 02:49PM UTC by deng.hui5 comment:1

sorry, this way works

	$( "#A, #B, #C, #D" ).autocomplete({
		minLength: 0,
		source: ...,
		focus: ...,
		select: ...
	}).each(function(){
		data( "autocomplete" )._renderItem = function( ul, item ) {
		return $( "<li></li>" )
			.data( "item.autocomplete", item )
			.append( "<a>" + item.code + ": " + item.description + "</a>" )
			.appendTo( ul );
	};});

then display

Changed October 05, 2012 12:36AM UTC by scottgonzalez comment:2

resolution: → invalid
status: newclosed

That's because all getters, including .data(), only work on a single element.