Opened 7 years ago

Closed 7 years ago

#8584 closed bug (notabug)

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 );
	};

Change History (2)

comment:1 Changed 7 years ago by deng.hui5

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

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

Resolution: invalid
Status: newclosed

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

Note: See TracTickets for help on using tickets.